fluentd-plugin-kinesis-intuit 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,44 @@
1
+ #
2
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # may not use this file except in compliance with the License. A copy of
6
+ # the License is located at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is
11
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
15
+ .PHONY: run run-td-agent-2.3.5 test test-td-agent-2.3.5 install $(wildcard test/test_*.rb) $(wildcard test/**/test_*.rb) benchmark benchmark-remote
16
+
17
+ all:
18
+ bundle install
19
+
20
+ run:
21
+ bundle exec fluentd -v
22
+
23
+ run-td-agent-2.3.5:
24
+ RBENV_VERSION=2.1.10 BUNDLE_GEMFILE=./gemfiles/Gemfile.td-agent-2.3.5 bundle update
25
+ RBENV_VERSION=2.1.10 BUNDLE_GEMFILE=./gemfiles/Gemfile.td-agent-2.3.5 bundle exec fluentd -v
26
+
27
+ test:
28
+ bundle exec rake test
29
+
30
+ test-td-agent-2.3.5:
31
+ RBENV_VERSION=2.1.10 BUNDLE_GEMFILE=./gemfiles/Gemfile.td-agent-2.3.5 bundle update
32
+ RBENV_VERSION=2.1.10 BUNDLE_GEMFILE=./gemfiles/Gemfile.td-agent-2.3.5 bundle exec rake test
33
+
34
+ install:
35
+ bundle exec rake install:local
36
+
37
+ $(wildcard test/test_*.rb) $(wildcard test/**/test_*.rb):
38
+ bundle exec rake test TEST=$@
39
+
40
+ benchmark:
41
+ bundle exec rake benchmark:local
42
+
43
+ benchmark-remote:
44
+ bundle exec rake benchmark:remote
@@ -0,0 +1,2 @@
1
+ Fluent Plugin for Amazon Kinesis
2
+ Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,62 @@
1
+ # Fluent plugin for Amazon Kinesis - Intuit
2
+
3
+ PURPOSE
4
+
5
+ Fluent plugin for Amazon Kinesis modified to be able to pass Splunk HEC Overrides
6
+
7
+
8
+ DESCRIPTION
9
+
10
+ In addition to the features provided by Amazon Kinesis fluentd plugin,
11
+ the following Splunk HEC Overrides can be passed as config params.
12
+ The same overrides are reflected at the Splunk endpoint.
13
+
14
+ 1. Splunk index
15
+ 2. Source
16
+ 3. Source type
17
+ 4. Host name
18
+
19
+ Example: The config params can be passed as given below:
20
+
21
+ @type kinesis_streams
22
+
23
+ # your kinesis stream name
24
+ stream_name test
25
+ index awesome
26
+ source ${tag}
27
+ sourcetype _json
28
+ host test-host
29
+
30
+ If the host name is not specified, the instance host name is sent across.
31
+
32
+
33
+ This configuration will
34
+
35
+ 1. send all events to the awesome index, and
36
+ 2. set their source to the event tags. ${tag} is a special value which will be replaced by the event tags, and
37
+ 3. set their sourcetype to _json.
38
+
39
+
40
+ Installation Procedure:
41
+
42
+ The gem can be installed using
43
+
44
+ gem install pkg/fluent-plugin-kinesis-intuit-2.1.1.gem
45
+
46
+ You can also build and install using
47
+
48
+ git clone https://github.intuit.com/cloud-logging/aws-fluent-plugin-kinesis-intuit.git
49
+ cd aws-fluent-plugin-kinesis-intuit
50
+ bundle install
51
+ bundle exec rake build
52
+ bundle exec rake install
53
+
54
+ Dependencies
55
+
56
+ Ruby 2.1.0+
57
+ Fluentd 0.14.10+
58
+
59
+
60
+ Please refer to the following link to know more about Fluent plugin for Amazon Kinesis
61
+
62
+ https://github.com/awslabs/aws-fluent-plugin-kinesis
@@ -0,0 +1,26 @@
1
+ #
2
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # may not use this file except in compliance with the License. A copy of
6
+ # the License is located at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is
11
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
15
+ require "bundler/gem_tasks"
16
+
17
+ require 'rake/testtask'
18
+
19
+ task default: [:test]
20
+ Rake::TestTask.new do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.test_files = FileList['test/**/test_*.rb']
23
+ test.options = '-v'
24
+ end
25
+
26
+ load 'benchmark/task.rake'
@@ -0,0 +1,106 @@
1
+ #
2
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # may not use this file except in compliance with the License. A copy of
6
+ # the License is located at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is
11
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
15
+ require_relative '../test/helper'
16
+ require 'fluent/plugin/out_kinesis_streams'
17
+ require 'fluent/plugin/out_kinesis_streams_aggregated'
18
+ require 'fluent/plugin/out_kinesis_firehose'
19
+ require 'benchmark'
20
+ require 'net/empty_port'
21
+
22
+ namespace :benchmark do
23
+ task :local do
24
+ KinesisBenchmark.new.run
25
+ end
26
+ task :remote do
27
+ KinesisBenchmark.new(false).run
28
+ end
29
+ end
30
+
31
+ class KinesisBenchmark
32
+ def initialize(local = true)
33
+ @local = local
34
+ Fluent::Test.setup
35
+ end
36
+
37
+ def run
38
+ setup
39
+ benchmark(ENV['SIZE'] || 100, ENV['COUNT'] || 10000)
40
+ teardown
41
+ end
42
+
43
+ def setup
44
+ return if not @local
45
+ @port = Net::EmptyPort.empty_port
46
+ @server_pid = fork do
47
+ Process.setsid
48
+ server = DummyServer.start(port: @port)
49
+ Signal.trap("TERM") do
50
+ server.shutdown
51
+ end
52
+ server.thread.join
53
+ end
54
+ Net::EmptyPort.wait(@port, 3)
55
+ end
56
+
57
+ def teardown
58
+ return if not @local
59
+ Process.kill "TERM", @server_pid
60
+ Process.waitpid @server_pid
61
+ end
62
+
63
+ def default_config
64
+ conf = %[
65
+ log_level error
66
+ region ap-northeast-1
67
+ data_key a
68
+ ]
69
+ if @local
70
+ conf += %[
71
+ endpoint https://localhost:#{@port}
72
+ ssl_verify_peer false
73
+ ]
74
+ end
75
+ conf
76
+ end
77
+
78
+ def create_driver(type, conf = default_config)
79
+ klass = case type
80
+ when :streams
81
+ Fluent::Plugin::KinesisStreamsOutput
82
+ when :streams_aggregated
83
+ Fluent::Plugin::KinesisStreamsAggregatedOutput
84
+ when :firehose
85
+ Fluent::Plugin::KinesisFirehoseOutput
86
+ end
87
+ conf += case type
88
+ when :streams, :streams_aggregated
89
+ "stream_name fluent-plugin-test"
90
+ when :firehose
91
+ "delivery_stream_name fluent-plugin-test"
92
+ end
93
+
94
+ Fluent::Test::Driver::Output.new(klass) do
95
+ end.configure(conf)
96
+ end
97
+
98
+ def benchmark(size, count)
99
+ record = {"a"=>"a"*size}
100
+ Benchmark.bmbm(20) do |x|
101
+ [:streams_aggregated, :streams, :firehose].each do |type|
102
+ x.report(type) { driver_run(create_driver(type), count.times.map{|i|record}) }
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,53 @@
1
+ # coding: utf-8
2
+ #
3
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
6
+ # may not use this file except in compliance with the License. A copy of
7
+ # the License is located at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # or in the "license" file accompanying this file. This file is
12
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
13
+ # ANY KIND, either express or implied. See the License for the specific
14
+ # language governing permissions and limitations under the License.
15
+
16
+ lib = File.expand_path('../lib', __FILE__)
17
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
18
+ require 'fluent_plugin_kinesis/version'
19
+
20
+ Gem::Specification.new do |spec|
21
+ spec.name = "fluentd-plugin-kinesis-intuit"
22
+ spec.version = FluentPluginKinesis::VERSION
23
+ spec.author = 'Amazon Web Services'
24
+ spec.summary = %q{Fluentd output plugin that sends events to Amazon Kinesis.}
25
+ spec.homepage = "https://github.intuit.com/cloud-logging/aws-fluent-plugin-kinesis-intuit"
26
+ spec.license = "Intuit"
27
+
28
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+ spec.required_ruby_version = '>= 2.1'
32
+
33
+ spec.add_dependency "fluentd", ">= 0.14.0", "< 2"
34
+
35
+ # This plugin is sometimes used with s3 plugin, so watch out for conflicts
36
+ # https://rubygems.org/gems/fluent-plugin-s3
37
+ spec.add_dependency "aws-sdk-kinesis", "~> 1"
38
+ spec.add_dependency "aws-sdk-firehose", "~> 1"
39
+
40
+ spec.add_dependency "google-protobuf", "~> 3"
41
+
42
+ spec.add_development_dependency "bundler", "~> 1.10"
43
+ spec.add_development_dependency "rake", "~> 10.0"
44
+ spec.add_development_dependency "test-unit", ">= 3.0.8"
45
+ spec.add_development_dependency "test-unit-rr", ">= 1.0.3"
46
+ spec.add_development_dependency "pry", ">= 0.10.1"
47
+ spec.add_development_dependency "pry-byebug", ">= 3.3.0"
48
+ spec.add_development_dependency "pry-stack_explorer", ">= 0.4.9.2"
49
+ spec.add_development_dependency "net-empty_port", ">= 0.0.2"
50
+ spec.add_development_dependency "mocha", ">= 1.1.0"
51
+ spec.add_development_dependency "webmock", ">= 1.24.2"
52
+ spec.add_development_dependency "fakefs", ">= 0.8.1"
53
+ end