fluent-plugin-kinesis 0.3.1
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.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.travis.yml +26 -0
- data/CHANGELOG.md +20 -0
- data/CONTRIBUTORS.txt +6 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +202 -0
- data/NOTICE.txt +2 -0
- data/README.md +307 -0
- data/Rakefile +23 -0
- data/fluent-plugin-kinesis.gemspec +41 -0
- data/lib/fluent/plugin/out_kinesis.rb +277 -0
- data/lib/fluent/plugin/version.rb +16 -0
- data/test/helper.rb +31 -0
- data/test/plugin/test_out_kinesis.rb +407 -0
- metadata +163 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 35e38cb880a0cdcd20e9b18028f0b3d1d543afc4
|
|
4
|
+
data.tar.gz: ee69de13c5e5e210010e74f54c9622be5468b5f9
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ae6b44445f454f9eff1310b9df28e2c28a004dc074465c22346de1bb2ae1a071ee22ffbc21cc24e6919a75e6d62ba0d56aecebd61913fbcba28e609d4f471d85
|
|
7
|
+
data.tar.gz: d42a53dcc0b3861983f6336c443ebb26218d865b8b6c84e62fd249fa357fb4a12c5f5b212f57935b033746e65f869e2fde39cb856b8c09938d3490c4d58d981e
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
|
|
3
|
+
rvm:
|
|
4
|
+
- 1.9.3
|
|
5
|
+
- 2.0.0
|
|
6
|
+
- 2.1
|
|
7
|
+
- 2.2
|
|
8
|
+
- ruby-head
|
|
9
|
+
- rbx-2
|
|
10
|
+
|
|
11
|
+
os:
|
|
12
|
+
- linux
|
|
13
|
+
- osx
|
|
14
|
+
|
|
15
|
+
gemfile:
|
|
16
|
+
- Gemfile
|
|
17
|
+
|
|
18
|
+
script: bundle exec rake
|
|
19
|
+
|
|
20
|
+
sudo: false
|
|
21
|
+
|
|
22
|
+
matrix:
|
|
23
|
+
allow_failures:
|
|
24
|
+
- rvm: ruby-head
|
|
25
|
+
- rvm: rbx-2
|
|
26
|
+
- rvm: 2.2
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
- **Fluentd v0.12 support**: We now support Fluentd v0.12.
|
|
6
|
+
|
|
7
|
+
## 0.3.0
|
|
8
|
+
|
|
9
|
+
- **Throughput improvement**: Added support for [PutRecords API](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html) by default.
|
|
10
|
+
- **Bug fix**: Removed redundant Base64 encoding of data for each Kinesis record emitted. Applications consuming these records will need to be updated accordingly.
|
|
11
|
+
|
|
12
|
+
## 0.2.0
|
|
13
|
+
|
|
14
|
+
- **Partition key randomization**: Added support for partition key randomization.
|
|
15
|
+
- **Throughput improvements**: Added support for spawning additional processes and threads to increase throughput to Amazon Kinesis.
|
|
16
|
+
- **AWS SDK for Ruby V2**: Added support for [AWS SDK for Ruby V2](https://github.com/aws/aws-sdk-core-ruby).
|
|
17
|
+
|
|
18
|
+
## 0.1.0
|
|
19
|
+
|
|
20
|
+
- Release on Github
|
data/CONTRIBUTORS.txt
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
|
5
|
+
# the License is located at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
|
12
|
+
# language governing permissions and limitations under the License.
|
|
13
|
+
|
|
14
|
+
source 'https://rubygems.org'
|
|
15
|
+
gemspec
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
data/NOTICE.txt
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Fluent Plugin for Amazon Kinesis
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/awslabs/aws-fluent-plugin-kinesis)
|
|
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
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
This project has not been published in rubygems.org at this time,
|
|
13
|
+
so you have to build and install by yourself.
|
|
14
|
+
Your need [bundler](http://bundler.io/) to install.
|
|
15
|
+
|
|
16
|
+
In case of using with Fluentd:
|
|
17
|
+
Fluentd will be also installed via the process below.
|
|
18
|
+
|
|
19
|
+
git clone https://github.com/awslabs/aws-fluent-plugin-kinesis.git
|
|
20
|
+
cd aws-fluent-plugin-kinesis
|
|
21
|
+
bundle install
|
|
22
|
+
rake build
|
|
23
|
+
rake install
|
|
24
|
+
|
|
25
|
+
Also, you can use this plugin with [td-agent](https://github.com/treasure-data/td-agent):
|
|
26
|
+
You have to install td-agent before installing this plugin.
|
|
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
|
+
fluent-gem install pkg/fluent-plugin-kinesis
|
|
33
|
+
|
|
34
|
+
Or just download specify your Ruby library path.
|
|
35
|
+
Below is the sample for specifying your library path via RUBYLIB.
|
|
36
|
+
|
|
37
|
+
git clone https://github.com/awslabs/aws-fluent-plugin-kinesis.git
|
|
38
|
+
cd aws-fluent-plugin-kinesis
|
|
39
|
+
bundle install
|
|
40
|
+
export RUBYLIB=$RUBYLIB:/path/to/aws-fluent-plugin-kinesis/lib
|
|
41
|
+
|
|
42
|
+
## Dependencies
|
|
43
|
+
|
|
44
|
+
* Ruby 1.9.3+
|
|
45
|
+
* Fluentd 0.10.43+
|
|
46
|
+
|
|
47
|
+
## Basic Usage
|
|
48
|
+
|
|
49
|
+
Here are general procedures for using this plugin:
|
|
50
|
+
|
|
51
|
+
1. Install.
|
|
52
|
+
1. Edit configuration
|
|
53
|
+
1. Run Fluentd or td-agent
|
|
54
|
+
|
|
55
|
+
You can run this plugin with Fluentd as follows:
|
|
56
|
+
|
|
57
|
+
1. Install.
|
|
58
|
+
1. Edit configuration file and save it as 'fluentd.conf'.
|
|
59
|
+
1. Then, run `fluentd -c /path/to/fluentd.conf`
|
|
60
|
+
|
|
61
|
+
To run with td-agent, it would be as follows:
|
|
62
|
+
|
|
63
|
+
1. Install.
|
|
64
|
+
1. Edit configuration file provided by td-agent.
|
|
65
|
+
1. Then, run or restart td-agent.
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
Here are items for Fluentd configuration file.
|
|
70
|
+
|
|
71
|
+
To put records into Amazon Kinesis,
|
|
72
|
+
you need to provide AWS security credentials.
|
|
73
|
+
If you provide aws_key_id and aws_sec_key in configuration file as below,
|
|
74
|
+
we use it. You can also provide credentials via environment variables as
|
|
75
|
+
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY. Also we support IAM Role for
|
|
76
|
+
authentication. Please find the [AWS SDK for Ruby Developer Guide](http://docs.aws.amazon.com/AWSSdkDocsRuby/latest/DeveloperGuide/ruby-dg-setup.html)
|
|
77
|
+
for more information about authentication.
|
|
78
|
+
We support all options which AWS SDK for Ruby supports.
|
|
79
|
+
|
|
80
|
+
### type
|
|
81
|
+
|
|
82
|
+
Use the word 'kinesis'.
|
|
83
|
+
|
|
84
|
+
### stream_name
|
|
85
|
+
|
|
86
|
+
Name of the stream to put data.
|
|
87
|
+
|
|
88
|
+
### aws_key_id
|
|
89
|
+
|
|
90
|
+
AWS access key id.
|
|
91
|
+
|
|
92
|
+
### aws_sec_key
|
|
93
|
+
|
|
94
|
+
AWS secret key.
|
|
95
|
+
|
|
96
|
+
### region
|
|
97
|
+
|
|
98
|
+
AWS region of your stream.
|
|
99
|
+
It should be in form like "us-east-1", "us-west-2".
|
|
100
|
+
Refer to [Regions and Endpoints in AWS General Reference](http://docs.aws.amazon.com/general/latest/gr/rande.html#ak_region)
|
|
101
|
+
for supported regions.
|
|
102
|
+
|
|
103
|
+
### random_partition_key
|
|
104
|
+
|
|
105
|
+
Boolean. If true, the plugin uses randomly generated
|
|
106
|
+
partition key for each record. Note that this parameter
|
|
107
|
+
overrides *partition_key*, *partition_key_expr*,
|
|
108
|
+
*explicit_hash_key* and *explicit_hash_key_expr*.
|
|
109
|
+
|
|
110
|
+
### partition_key
|
|
111
|
+
|
|
112
|
+
A key to extract partition key from JSON object.
|
|
113
|
+
|
|
114
|
+
### partition_key_expr
|
|
115
|
+
|
|
116
|
+
A Ruby expression to extract partition key from JSON object.
|
|
117
|
+
We treat your expression as below.
|
|
118
|
+
|
|
119
|
+
a_proc = eval(sprintf('proc {|record| %s }', YOUR_EXPRESSION))
|
|
120
|
+
a_proc.call(record)
|
|
121
|
+
|
|
122
|
+
You should write your Ruby expression that receives input data
|
|
123
|
+
as a variable 'record', process it and return it. The returned
|
|
124
|
+
value will be used as a partition key. For use case example,
|
|
125
|
+
see 'Configuration examples' part.
|
|
126
|
+
|
|
127
|
+
### explicit_hash_key
|
|
128
|
+
|
|
129
|
+
A key to extract explicit hash key from JSON object.
|
|
130
|
+
Explicit hash key is hash value used to explicitly
|
|
131
|
+
determine the shard the data record is assigned to
|
|
132
|
+
by overriding the partition key hash.
|
|
133
|
+
|
|
134
|
+
### explicit_hash_key_expr
|
|
135
|
+
|
|
136
|
+
A Ruby expression to extract explicit hash key from JSON object.
|
|
137
|
+
Your expression will be treat in the same way as we treat partition_key_expr.
|
|
138
|
+
|
|
139
|
+
### order_events
|
|
140
|
+
|
|
141
|
+
Boolean. By enabling it, you can strictly order events in Amazon Kinesis,
|
|
142
|
+
according to arrival of events. Without this, events will be coarsely ordered
|
|
143
|
+
based on arrival time. For detail,
|
|
144
|
+
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).
|
|
145
|
+
|
|
146
|
+
Please note that if you set *detach_process* or *num_threads greater than 1*,
|
|
147
|
+
this option will be ignored.
|
|
148
|
+
|
|
149
|
+
### detach_process
|
|
150
|
+
|
|
151
|
+
Integer. Optional. This defines the number of parallel processes to start.
|
|
152
|
+
This can be used to increase throughput by allowing multiple processes to
|
|
153
|
+
execute the plugin at once. This cannot be used together with **order_events**.
|
|
154
|
+
Setting this option to > 0 will cause the plugin to run in a separate
|
|
155
|
+
process. The default is 0.
|
|
156
|
+
|
|
157
|
+
### num_threads
|
|
158
|
+
|
|
159
|
+
Integer. The number of threads to flush the buffer. This plugin is based on
|
|
160
|
+
Fluentd::BufferedOutput, so we buffer incoming records before emitting them to
|
|
161
|
+
Amazon Kinesis. You can find the detail about buffering mechanism [here](http://docs.fluentd.org/articles/buffer-plugin-overview).
|
|
162
|
+
Emitting records to Amazon Kinesis via network causes I/O Wait, so parallelizing
|
|
163
|
+
emitting with threads will improve throughput.
|
|
164
|
+
|
|
165
|
+
This option can be used to parallelize writes into the output(s)
|
|
166
|
+
designated by the output plugin. The default is 1.
|
|
167
|
+
Also you can use this option with *detach_process*.
|
|
168
|
+
|
|
169
|
+
### retries_on_putrecords
|
|
170
|
+
|
|
171
|
+
Integer, default is 3. When **order_events** is false, the plugin will put multiple
|
|
172
|
+
records to Amazon Kinesis in batches using PutRecords. A set of records in a batch
|
|
173
|
+
may fail for reasons documented in the Kinesis Service API Reference for PutRecords.
|
|
174
|
+
Failed records will be retried **retries_on_putrecords** times. If a record
|
|
175
|
+
fails all retries an error log will be emitted.
|
|
176
|
+
|
|
177
|
+
### debug
|
|
178
|
+
|
|
179
|
+
Boolean. Enable if you need to debug Amazon Kinesis API call. Default is false.
|
|
180
|
+
|
|
181
|
+
## Configuration examples
|
|
182
|
+
|
|
183
|
+
Here are some configuration examles.
|
|
184
|
+
Assume that the JSON object below is coming to with tag 'your_tag'.
|
|
185
|
+
|
|
186
|
+
{
|
|
187
|
+
"name":"foo",
|
|
188
|
+
"action":"bar"
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
### Simply putting events to Amazon Kinesis with a partition key
|
|
192
|
+
|
|
193
|
+
In this example, simply a value 'foo' will be used as partition key,
|
|
194
|
+
then events will be sent to the stream specified in 'stream_name'.
|
|
195
|
+
|
|
196
|
+
<match your_tag>
|
|
197
|
+
type kinesis
|
|
198
|
+
|
|
199
|
+
stream_name YOUR_STREAM_NAME
|
|
200
|
+
|
|
201
|
+
aws_key_id YOUR_AWS_ACCESS_KEY
|
|
202
|
+
aws_sec_key YOUR_SECRET_KEY
|
|
203
|
+
|
|
204
|
+
region us-east-1
|
|
205
|
+
|
|
206
|
+
partition_key name
|
|
207
|
+
</match>
|
|
208
|
+
|
|
209
|
+
### Using partition_key_expr to add specific prefix to partition key
|
|
210
|
+
|
|
211
|
+
In this example, we add partition_key_expr to the example above.
|
|
212
|
+
This expression adds string 'some_prefix-' to partition key 'name',
|
|
213
|
+
then partition key finally will be 'some_prefix-foo'.
|
|
214
|
+
|
|
215
|
+
With specifying parition_key and parition_key_expr both,
|
|
216
|
+
the extracted value for partition key from JSON object will be
|
|
217
|
+
passed to your Ruby expression as a variable 'record'.
|
|
218
|
+
|
|
219
|
+
<match your_tag>
|
|
220
|
+
type kinesis
|
|
221
|
+
|
|
222
|
+
stream_name YOUR_STREAM_NAME
|
|
223
|
+
|
|
224
|
+
aws_key_id YOUR_AWS_ACCESS_KEY
|
|
225
|
+
aws_sec_key YOUR_SECRET_KEY
|
|
226
|
+
|
|
227
|
+
region us-east-1
|
|
228
|
+
|
|
229
|
+
partition_key name
|
|
230
|
+
partition_key_expr 'some_prefix-' + record
|
|
231
|
+
</match>
|
|
232
|
+
|
|
233
|
+
### Using partition_key_expr to extract a value for partition key
|
|
234
|
+
|
|
235
|
+
In this example, we use only partition_key_expr to extract
|
|
236
|
+
a value for partition key. It will be 'bar'.
|
|
237
|
+
|
|
238
|
+
Specifying partition_key_expr without partition_key,
|
|
239
|
+
hash object that is converted from whole JSON object will be
|
|
240
|
+
passed to your Ruby expression as a variable 'record'.
|
|
241
|
+
|
|
242
|
+
<match your_tag>
|
|
243
|
+
type kinesis
|
|
244
|
+
|
|
245
|
+
stream_name YOUR_STREAM_NAME
|
|
246
|
+
|
|
247
|
+
aws_key_id YOUR_AWS_ACCESS_KEY
|
|
248
|
+
aws_sec_key YOUR_SECRET_KEY
|
|
249
|
+
|
|
250
|
+
region us-east-1
|
|
251
|
+
|
|
252
|
+
partition_key_expr record['action']
|
|
253
|
+
</match>
|
|
254
|
+
|
|
255
|
+
### Improving throughput to Amazon Kinesis
|
|
256
|
+
|
|
257
|
+
The achievable throughput to Amazon Kinesis is limited to single-threaded
|
|
258
|
+
PutRecord calls if **order_events** is set to true. By setting **order_events**
|
|
259
|
+
to false records will be sent to Amazon Kinesis in batches. When operating in
|
|
260
|
+
this mode the plugin can also be configured to execute in parallel.
|
|
261
|
+
The **detach_process** and **num_threads** configuration settings control
|
|
262
|
+
parallelism.
|
|
263
|
+
|
|
264
|
+
Please note that **order_events** option will be ignored if you choose to
|
|
265
|
+
use either **detach_process** or **num_threads**.
|
|
266
|
+
|
|
267
|
+
In case of the configuration below, you will spawn 2 processes.
|
|
268
|
+
|
|
269
|
+
<match your_tag>
|
|
270
|
+
type kinesis
|
|
271
|
+
|
|
272
|
+
stream_name YOUR_STREAM_NAME
|
|
273
|
+
region us-east-1
|
|
274
|
+
|
|
275
|
+
detach_process 2
|
|
276
|
+
|
|
277
|
+
</match>
|
|
278
|
+
|
|
279
|
+
You can also specify a number of threads to put.
|
|
280
|
+
The number of threads is bound to each individual processes.
|
|
281
|
+
So in this case, you will spawn 1 process which has 50 threads.
|
|
282
|
+
|
|
283
|
+
<match your_tag>
|
|
284
|
+
type kinesis
|
|
285
|
+
|
|
286
|
+
stream_name YOUR_STREAM_NAME
|
|
287
|
+
region us-east-1
|
|
288
|
+
|
|
289
|
+
num_threads 50
|
|
290
|
+
</match>
|
|
291
|
+
|
|
292
|
+
Both options can be used together, in the configuration below,
|
|
293
|
+
you will spawn 2 processes and 50 threads per each processes.
|
|
294
|
+
|
|
295
|
+
<match your_tag>
|
|
296
|
+
type kinesis
|
|
297
|
+
|
|
298
|
+
stream_name YOUR_STREAM_NAME
|
|
299
|
+
region us-east-1
|
|
300
|
+
|
|
301
|
+
detach_process 2
|
|
302
|
+
num_threads 50
|
|
303
|
+
</match>
|
|
304
|
+
|
|
305
|
+
## Related Resources
|
|
306
|
+
|
|
307
|
+
* [Amazon Kinesis Developer Guide](http://docs.aws.amazon.com/kinesis/latest/dev/introduction.html)
|