fluent-plugin-kinesis 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -23
  3. data/CHANGELOG.md +13 -0
  4. data/Gemfile +9 -9
  5. data/LICENSE.txt +201 -40
  6. data/Makefile +24 -31
  7. data/README.md +179 -308
  8. data/Rakefile +9 -13
  9. data/benchmark/task.rake +96 -58
  10. data/fluent-plugin-kinesis.gemspec +15 -19
  11. data/gemfiles/Gemfile.fluentd-0.12 +10 -10
  12. data/lib/fluent/plugin/kinesis.rb +166 -0
  13. data/lib/fluent/plugin/kinesis_helper/aggregator.rb +99 -0
  14. data/lib/fluent/plugin/kinesis_helper/api.rb +152 -121
  15. data/lib/fluent/plugin/kinesis_helper/client.rb +125 -12
  16. data/lib/fluent/plugin/out_kinesis_firehose.rb +40 -27
  17. data/lib/fluent/plugin/out_kinesis_streams.rb +51 -30
  18. data/lib/fluent/plugin/out_kinesis_streams_aggregated.rb +76 -0
  19. data/lib/fluent_plugin_kinesis/version.rb +10 -10
  20. metadata +18 -70
  21. data/README-v0.4.md +0 -348
  22. data/benchmark/dummy.conf +0 -0
  23. data/gemfiles/Gemfile.aws-sdk-2.4 +0 -20
  24. data/gemfiles/Gemfile.fluentd-0.10.58 +0 -20
  25. data/gemfiles/Gemfile.fluentd-0.14.11 +0 -20
  26. data/gemfiles/Gemfile.ruby-2.0 +0 -21
  27. data/gemfiles/Gemfile.ruby-2.1 +0 -21
  28. data/lib/fluent/plugin/kinesis_helper.rb +0 -36
  29. data/lib/fluent/plugin/kinesis_helper/class_methods.rb +0 -123
  30. data/lib/fluent/plugin/kinesis_helper/credentials.rb +0 -51
  31. data/lib/fluent/plugin/kinesis_helper/error.rb +0 -43
  32. data/lib/fluent/plugin/kinesis_helper/format.rb +0 -85
  33. data/lib/fluent/plugin/kinesis_helper/initialize.rb +0 -59
  34. data/lib/fluent/plugin/kinesis_helper/kpl.rb +0 -82
  35. data/lib/fluent/plugin/out_kinesis.rb +0 -323
  36. data/lib/fluent/plugin/out_kinesis_producer.rb +0 -48
  37. data/lib/fluent/plugin/patched_detach_process_impl.rb +0 -103
  38. data/lib/kinesis_producer.rb +0 -24
  39. data/lib/kinesis_producer/binary.rb +0 -10
  40. data/lib/kinesis_producer/daemon.rb +0 -270
  41. data/lib/kinesis_producer/library.rb +0 -122
  42. data/lib/kinesis_producer/protobuf/config.pb.rb +0 -66
  43. data/lib/kinesis_producer/protobuf/messages.pb.rb +0 -151
  44. data/lib/kinesis_producer/tasks/binary.rake +0 -73
data/README-v0.4.md DELETED
@@ -1,348 +0,0 @@
1
- # Deprecated: Fluent Plugin for Amazon Kinesis v0.4
2
-
3
- Please see [the latest README](https://github.com/awslabs/aws-fluent-plugin-kinesis/blob/master/README.md).
4
-
5
- ## Overview
6
-
7
- [Fluentd](http://fluentd.org/) output plugin
8
- that sends events to [Amazon Kinesis](https://aws.amazon.com/kinesis/).
9
-
10
- Also, there is a documentation on [Fluentd official site](http://docs.fluentd.org/articles/kinesis-stream).
11
-
12
- ## Installation
13
-
14
- This fluentd plugin is available as the `fluent-plugin-kinesis` gem from RubyGems.
15
-
16
- gem install fluent-plugin-kinesis
17
-
18
- Or you can install this plugin for [td-agent](https://github.com/treasure-data/td-agent) as:
19
-
20
- fluent-gem install fluent-plugin-kinesis
21
-
22
- If you would like to build by yourself and install, please see the section below.
23
- Your need [bundler](http://bundler.io/) for this.
24
-
25
- In case of using with Fluentd:
26
- Fluentd will be also installed via the process below.
27
-
28
- git clone https://github.com/awslabs/aws-fluent-plugin-kinesis.git
29
- cd aws-fluent-plugin-kinesis
30
- bundle install
31
- rake build
32
- rake install
33
-
34
- Also, you can use this plugin with td-agent:
35
- You have to install td-agent before installing this plugin.
36
-
37
- git clone https://github.com/awslabs/aws-fluent-plugin-kinesis.git
38
- cd aws-fluent-plugin-kinesis
39
- bundle install
40
- rake build
41
- fluent-gem install pkg/fluent-plugin-kinesis
42
-
43
- Or just download specify your Ruby library path.
44
- Below is the sample for specifying your library path via RUBYLIB.
45
-
46
- git clone https://github.com/awslabs/aws-fluent-plugin-kinesis.git
47
- cd aws-fluent-plugin-kinesis
48
- bundle install
49
- export RUBYLIB=$RUBYLIB:/path/to/aws-fluent-plugin-kinesis/lib
50
-
51
- ## Dependencies
52
-
53
- * Ruby 2.0.0+
54
- * Fluentd 0.10.58+
55
-
56
- ## Basic Usage
57
-
58
- Here are general procedures for using this plugin:
59
-
60
- 1. Install.
61
- 1. Edit configuration
62
- 1. Run Fluentd or td-agent
63
-
64
- You can run this plugin with Fluentd as follows:
65
-
66
- 1. Install.
67
- 1. Edit configuration file and save it as 'fluentd.conf'.
68
- 1. Then, run `fluentd -c /path/to/fluentd.conf`
69
-
70
- To run with td-agent, it would be as follows:
71
-
72
- 1. Install.
73
- 1. Edit configuration file provided by td-agent.
74
- 1. Then, run or restart td-agent.
75
-
76
- ## Configuration
77
-
78
- Here are items for Fluentd configuration file.
79
-
80
- To put records into Amazon Kinesis,
81
- you need to provide AWS security credentials.
82
- If you provide aws_key_id and aws_sec_key in configuration file as below,
83
- we use it. You can also provide credentials via environment variables as
84
- AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY. Also we support IAM Role for
85
- authentication. Please find the [AWS SDK for Ruby Developer Guide](http://docs.aws.amazon.com/AWSSdkDocsRuby/latest/DeveloperGuide/ruby-dg-setup.html)
86
- for more information about authentication.
87
- We support all options which AWS SDK for Ruby supports.
88
-
89
- ### type
90
-
91
- Use the word 'kinesis'.
92
-
93
- ### stream_name
94
-
95
- Name of the stream to put data.
96
-
97
- ### aws_key_id
98
-
99
- AWS access key id.
100
-
101
- ### aws_sec_key
102
-
103
- AWS secret key.
104
-
105
- ### role_arn
106
-
107
- IAM Role to be assumed with [AssumeRole](http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html).
108
- Use this option for cross account access.
109
-
110
- ### external_id
111
-
112
- A unique identifier that is used by third parties when
113
- [assuming roles](http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) in their customers' accounts.
114
- Use this option with `role_arn` for third party cross account access.
115
- For detail, please see [How to Use an External ID When Granting Access to Your AWS Resources to a Third Party](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html).
116
-
117
- ### region
118
-
119
- AWS region of your stream.
120
- It should be in form like "us-east-1", "us-west-2".
121
- Refer to [Regions and Endpoints in AWS General Reference](http://docs.aws.amazon.com/general/latest/gr/rande.html#ak_region)
122
- for supported regions.
123
-
124
- ### ensure_stream_connection
125
-
126
- When enabled, the plugin checks and ensures a connection to the stream you are using by [DescribeStream](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_DescribeStream.html) and throws exception if it fails. Enabled by default.
127
-
128
- ### http_proxy
129
-
130
- Proxy server, if any.
131
- It should be in form like "http://squid:3128/"
132
-
133
- ### random_partition_key
134
-
135
- Boolean. If true, the plugin uses randomly generated
136
- partition key for each record. Note that this parameter
137
- overrides *partition_key*, *partition_key_expr*,
138
- *explicit_hash_key* and *explicit_hash_key_expr*.
139
-
140
- ### partition_key
141
-
142
- A key to extract partition key from JSON object.
143
-
144
- ### partition_key_expr
145
-
146
- A Ruby expression to extract partition key from JSON object.
147
- We treat your expression as below.
148
-
149
- a_proc = eval(sprintf('proc {|record| %s }', YOUR_EXPRESSION))
150
- a_proc.call(record)
151
-
152
- You should write your Ruby expression that receives input data
153
- as a variable 'record', process it and return it. The returned
154
- value will be used as a partition key. For use case example,
155
- see 'Configuration examples' part.
156
-
157
- ### explicit_hash_key
158
-
159
- A key to extract explicit hash key from JSON object.
160
- Explicit hash key is hash value used to explicitly
161
- determine the shard the data record is assigned to
162
- by overriding the partition key hash.
163
-
164
- ### explicit_hash_key_expr
165
-
166
- A Ruby expression to extract explicit hash key from JSON object.
167
- Your expression will be treat in the same way as we treat partition_key_expr.
168
-
169
- ### order_events
170
-
171
- Boolean. By enabling it, you can strictly order events in Amazon Kinesis,
172
- according to arrival of events. Without this, events will be coarsely ordered
173
- based on arrival time. For detail,
174
- see [Using the Amazon Kinesis Service API](http://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-api-java.html#kinesis-using-api-defn-sequence-number).
175
-
176
- Please note that if you set *detach_process* or *num_threads greater than 1*,
177
- this option will be ignored.
178
-
179
- ### detach_process
180
-
181
- Integer. Optional. This defines the number of parallel processes to start.
182
- This can be used to increase throughput by allowing multiple processes to
183
- execute the plugin at once. This cannot be used together with **order_events**.
184
- Setting this option to > 0 will cause the plugin to run in a separate
185
- process. The default is 0.
186
-
187
- ### num_threads
188
-
189
- Integer. The number of threads to flush the buffer. This plugin is based on
190
- Fluentd::BufferedOutput, so we buffer incoming records before emitting them to
191
- Amazon Kinesis. You can find the detail about buffering mechanism [here](http://docs.fluentd.org/articles/buffer-plugin-overview).
192
- Emitting records to Amazon Kinesis via network causes I/O Wait, so parallelizing
193
- emitting with threads will improve throughput.
194
-
195
- This option can be used to parallelize writes into the output(s)
196
- designated by the output plugin. The default is 1.
197
- Also you can use this option with *detach_process*.
198
-
199
- ### retries_on_putrecords
200
-
201
- Integer, default is 3. When **order_events** is false, the plugin will put multiple
202
- records to Amazon Kinesis in batches using PutRecords. A set of records in a batch
203
- may fail for reasons documented in the Kinesis Service API Reference for PutRecords.
204
- Failed records will be retried **retries_on_putrecords** times. If a record
205
- fails all retries an error log will be emitted.
206
-
207
- ### use_yajl
208
-
209
- Boolean, default is false.
210
- In case you find error `Encoding::UndefinedConversionError` with multibyte texts, you can avoid that error with this option.
211
-
212
- ### zlib_compression
213
-
214
- Boolean, default is false.
215
- Zlib compresses the message data blob.
216
- Each zlib compressed message must remain within megabyte in size.
217
-
218
- ### debug
219
-
220
- Boolean. Enable if you need to debug Amazon Kinesis API call. Default is false.
221
-
222
- ## Configuration examples
223
-
224
- Here are some configuration examles.
225
- Assume that the JSON object below is coming to with tag 'your_tag'.
226
-
227
- {
228
- "name":"foo",
229
- "action":"bar"
230
- }
231
-
232
- ### Simply putting events to Amazon Kinesis with a partition key
233
-
234
- In this example, simply a value 'foo' will be used as partition key,
235
- then events will be sent to the stream specified in 'stream_name'.
236
-
237
- <match your_tag>
238
- type kinesis
239
-
240
- stream_name YOUR_STREAM_NAME
241
-
242
- aws_key_id YOUR_AWS_ACCESS_KEY
243
- aws_sec_key YOUR_SECRET_KEY
244
-
245
- region us-east-1
246
-
247
- partition_key name
248
- </match>
249
-
250
- ### Using partition_key_expr to add specific prefix to partition key
251
-
252
- In this example, we add partition_key_expr to the example above.
253
- This expression adds string 'some_prefix-' to partition key 'name',
254
- then partition key finally will be 'some_prefix-foo'.
255
-
256
- With specifying parition_key and parition_key_expr both,
257
- the extracted value for partition key from JSON object will be
258
- passed to your Ruby expression as a variable 'record'.
259
-
260
- <match your_tag>
261
- type kinesis
262
-
263
- stream_name YOUR_STREAM_NAME
264
-
265
- aws_key_id YOUR_AWS_ACCESS_KEY
266
- aws_sec_key YOUR_SECRET_KEY
267
-
268
- region us-east-1
269
-
270
- partition_key name
271
- partition_key_expr 'some_prefix-' + record
272
- </match>
273
-
274
- ### Using partition_key_expr to extract a value for partition key
275
-
276
- In this example, we use only partition_key_expr to extract
277
- a value for partition key. It will be 'bar'.
278
-
279
- Specifying partition_key_expr without partition_key,
280
- hash object that is converted from whole JSON object will be
281
- passed to your Ruby expression as a variable 'record'.
282
-
283
- <match your_tag>
284
- type kinesis
285
-
286
- stream_name YOUR_STREAM_NAME
287
-
288
- aws_key_id YOUR_AWS_ACCESS_KEY
289
- aws_sec_key YOUR_SECRET_KEY
290
-
291
- region us-east-1
292
-
293
- partition_key_expr record['action']
294
- </match>
295
-
296
- ### Improving throughput to Amazon Kinesis
297
-
298
- The achievable throughput to Amazon Kinesis is limited to single-threaded
299
- PutRecord calls if **order_events** is set to true. By setting **order_events**
300
- to false records will be sent to Amazon Kinesis in batches. When operating in
301
- this mode the plugin can also be configured to execute in parallel.
302
- The **detach_process** and **num_threads** configuration settings control
303
- parallelism.
304
-
305
- Please note that **order_events** option will be ignored if you choose to
306
- use either **detach_process** or **num_threads**.
307
-
308
- In case of the configuration below, you will spawn 2 processes.
309
-
310
- <match your_tag>
311
- type kinesis
312
-
313
- stream_name YOUR_STREAM_NAME
314
- region us-east-1
315
-
316
- detach_process 2
317
-
318
- </match>
319
-
320
- You can also specify a number of threads to put.
321
- The number of threads is bound to each individual processes.
322
- So in this case, you will spawn 1 process which has 50 threads.
323
-
324
- <match your_tag>
325
- type kinesis
326
-
327
- stream_name YOUR_STREAM_NAME
328
- region us-east-1
329
-
330
- num_threads 50
331
- </match>
332
-
333
- Both options can be used together, in the configuration below,
334
- you will spawn 2 processes and 50 threads per each processes.
335
-
336
- <match your_tag>
337
- type kinesis
338
-
339
- stream_name YOUR_STREAM_NAME
340
- region us-east-1
341
-
342
- detach_process 2
343
- num_threads 50
344
- </match>
345
-
346
- ## Related Resources
347
-
348
- * [Amazon Kinesis Developer Guide](http://docs.aws.amazon.com/kinesis/latest/dev/introduction.html)
data/benchmark/dummy.conf DELETED
File without changes
@@ -1,20 +0,0 @@
1
- #
2
- # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- #
4
- # Licensed under the Amazon Software License (the "License").
5
- # You may not use this file except in compliance with the License.
6
- # A copy of the License is located at
7
- #
8
- # http://aws.amazon.com/asl/
9
- #
10
- # or in the "license" file accompanying this file. This file is distributed
11
- # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
- # express or implied. See the License for the specific language governing
13
- # permissions and limitations under the License.
14
-
15
- source 'https://rubygems.org'
16
-
17
- # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
18
- gemspec path: ".."
19
-
20
- gem "aws-sdk", "~> 2.4.4"
@@ -1,20 +0,0 @@
1
- #
2
- # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- #
4
- # Licensed under the Amazon Software License (the "License").
5
- # You may not use this file except in compliance with the License.
6
- # A copy of the License is located at
7
- #
8
- # http://aws.amazon.com/asl/
9
- #
10
- # or in the "license" file accompanying this file. This file is distributed
11
- # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
- # express or implied. See the License for the specific language governing
13
- # permissions and limitations under the License.
14
-
15
- source 'https://rubygems.org'
16
-
17
- # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
18
- gemspec path: ".."
19
-
20
- gem "fluentd", "0.10.58"
@@ -1,20 +0,0 @@
1
- #
2
- # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- #
4
- # Licensed under the Amazon Software License (the "License").
5
- # You may not use this file except in compliance with the License.
6
- # A copy of the License is located at
7
- #
8
- # http://aws.amazon.com/asl/
9
- #
10
- # or in the "license" file accompanying this file. This file is distributed
11
- # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
- # express or implied. See the License for the specific language governing
13
- # permissions and limitations under the License.
14
-
15
- source 'https://rubygems.org'
16
-
17
- # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
18
- gemspec path: ".."
19
-
20
- gem "fluentd", "~> 0.14.11"
@@ -1,21 +0,0 @@
1
- #
2
- # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- #
4
- # Licensed under the Amazon Software License (the "License").
5
- # You may not use this file except in compliance with the License.
6
- # A copy of the License is located at
7
- #
8
- # http://aws.amazon.com/asl/
9
- #
10
- # or in the "license" file accompanying this file. This file is distributed
11
- # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
- # express or implied. See the License for the specific language governing
13
- # permissions and limitations under the License.
14
-
15
- source 'https://rubygems.org'
16
-
17
- # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
18
- gemspec path: ".."
19
-
20
- gem "activesupport", "~> 4"
21
- gem "fluentd", "~> 0.12.26"
@@ -1,21 +0,0 @@
1
- #
2
- # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- #
4
- # Licensed under the Amazon Software License (the "License").
5
- # You may not use this file except in compliance with the License.
6
- # A copy of the License is located at
7
- #
8
- # http://aws.amazon.com/asl/
9
- #
10
- # or in the "license" file accompanying this file. This file is distributed
11
- # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
- # express or implied. See the License for the specific language governing
13
- # permissions and limitations under the License.
14
-
15
- source 'https://rubygems.org'
16
-
17
- # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
18
- gemspec path: ".."
19
-
20
- gem "activesupport", "~> 4"
21
- gem "fluentd", "~> 0.12.26"