madhawk57-log 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +21 -0
- data/ChangeLog +254 -0
- data/Gemfile +6 -0
- data/LICENSE +14 -0
- data/README.md +463 -0
- data/Rakefile +12 -0
- data/fluent-plugin-kafka.gemspec +23 -0
- data/lib/fluent/plugin/in_kafka.rb +360 -0
- data/lib/fluent/plugin/in_kafka_group.rb +309 -0
- data/lib/fluent/plugin/kafka_plugin_util.rb +105 -0
- data/lib/fluent/plugin/kafka_producer_ext.rb +304 -0
- data/lib/fluent/plugin/out_kafka.rb +266 -0
- data/lib/fluent/plugin/out_kafka2.rb +297 -0
- data/lib/fluent/plugin/out_kafka_buffered.rb +372 -0
- data/lib/fluent/plugin/out_rdkafka.rb +316 -0
- data/lib/fluent/plugin/out_rdkafka2.rb +349 -0
- data/test/helper.rb +27 -0
- data/test/plugin/test_out_kafka.rb +61 -0
- metadata +168 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e658101d8d7eb4fc8bfd4b68b84d173c3160405359ff9643b42c9753b7d55712
|
|
4
|
+
data.tar.gz: be5eb51793b4876cc4d20ef502b195cc41a65fd3242caf9067b669450a9e47db
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 88ffa2d3a61162e24fe89a3fe92a1afed1737faa97c8e0eda188ce7b11ce5244c266590b36f1514ed617b2980f5886d16b0f947f78159383550565bf8bfe1747
|
|
7
|
+
data.tar.gz: b9ec57f4c3b4960b57731a8780310c9d71d9340a4ca3e93c08d8acccf151a660ad8e1e66fafc4310429e0e4d857a0135b8fb8d31326e1f894ee6439c5e392faf
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
|
|
3
|
+
rvm:
|
|
4
|
+
- 2.1
|
|
5
|
+
- 2.2
|
|
6
|
+
- 2.3.1
|
|
7
|
+
- 2.4.1
|
|
8
|
+
- 2.5.0
|
|
9
|
+
- ruby-head
|
|
10
|
+
|
|
11
|
+
before_install:
|
|
12
|
+
- gem update --system=2.7.8
|
|
13
|
+
script:
|
|
14
|
+
- bundle exec rake test
|
|
15
|
+
|
|
16
|
+
sudo: false
|
|
17
|
+
|
|
18
|
+
matrix:
|
|
19
|
+
allow_failures:
|
|
20
|
+
- rvm: ruby-head
|
|
21
|
+
|
data/ChangeLog
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
Release 0.13.0 - 2020/03/09
|
|
2
|
+
|
|
3
|
+
* Accept ruby-kafka v1 or later
|
|
4
|
+
|
|
5
|
+
Release 0.12.4 - 2020/03/03
|
|
6
|
+
|
|
7
|
+
* output: Follow rdkafka log level
|
|
8
|
+
|
|
9
|
+
Release 0.12.3 - 2020/02/06
|
|
10
|
+
|
|
11
|
+
* output: Show warning message for v0.12 plugins
|
|
12
|
+
|
|
13
|
+
Release 0.12.2 - 2020/01/07
|
|
14
|
+
|
|
15
|
+
* input: Refer sasl_over_ssl parameter in plain SASL
|
|
16
|
+
|
|
17
|
+
Release 0.12.1 - 2019/10/14
|
|
18
|
+
|
|
19
|
+
* input: Add time_source parameter to replace use_record_time
|
|
20
|
+
|
|
21
|
+
Release 0.12.0 - 2019/09/27
|
|
22
|
+
|
|
23
|
+
* Support rdkafka-ruby v0.7. Drop v0.6 support.
|
|
24
|
+
|
|
25
|
+
Release 0.11.2 - 2019/09/27
|
|
26
|
+
|
|
27
|
+
* out_rdkafka2: Add share_producer parameter
|
|
28
|
+
|
|
29
|
+
Release 0.11.1 - 2019/08/22
|
|
30
|
+
|
|
31
|
+
* out_kafka2: Fix mutating issue of headers
|
|
32
|
+
|
|
33
|
+
Release 0.11.0 - 2019/07/17
|
|
34
|
+
|
|
35
|
+
* out_kafka2: Add connect_timeout / socket_timeout parameters
|
|
36
|
+
* out_kafka2/out_rdkafka2: Add headers / headers_from_record parameters
|
|
37
|
+
* output: Add use_event_time parameter to use fluentd event time for CreateTime
|
|
38
|
+
* input: Add get_kafka_client_log parameter. Default is `false`
|
|
39
|
+
|
|
40
|
+
Release 0.10.0 - 2019/07/03
|
|
41
|
+
|
|
42
|
+
* output: Fixed max_send_limit_bytes parameter to be in all kafka outputs
|
|
43
|
+
* output: Add ssl_verify_hostname parameter
|
|
44
|
+
* rdkafka output: Fix exceptiona handling
|
|
45
|
+
* Update ruby-kafka version to v0.7.8 or later
|
|
46
|
+
|
|
47
|
+
Release 0.9.6 - 2019/05/28
|
|
48
|
+
|
|
49
|
+
* out_kafka2: Add metadata nil check
|
|
50
|
+
|
|
51
|
+
Release 0.9.5 - 2019/05/23
|
|
52
|
+
|
|
53
|
+
* output: Support sasl_over_ssl parameter to not use SSL with SASL/GSSAPI
|
|
54
|
+
|
|
55
|
+
Release 0.9.4 - 2019/05/13
|
|
56
|
+
|
|
57
|
+
* out_rdkafka2: Add metadata nil check
|
|
58
|
+
|
|
59
|
+
Release 0.9.3 - 2019/05/04
|
|
60
|
+
|
|
61
|
+
* in_kafka_group: Add connect_timeout and socket_timeout parameters
|
|
62
|
+
|
|
63
|
+
Release 0.9.2 - 2019/03/26
|
|
64
|
+
|
|
65
|
+
* out_kafka_buffered: Fix typo of partition_key usage
|
|
66
|
+
|
|
67
|
+
Release 0.9.1 - 2019/03/25
|
|
68
|
+
|
|
69
|
+
* output: Support sasl_over_ssl parameter
|
|
70
|
+
* Support ruby-kafka 0.7.6
|
|
71
|
+
|
|
72
|
+
Release 0.9.0 - 2019/02/22
|
|
73
|
+
|
|
74
|
+
* Add v1 API based rdkafka2 output plugin
|
|
75
|
+
* out_kafka2: Add use_default_for_unknown_topic parameter
|
|
76
|
+
|
|
77
|
+
Release 0.8.4 - 2019/01/18
|
|
78
|
+
|
|
79
|
+
* in_kafka_group: Support integer/float time field with time_format
|
|
80
|
+
|
|
81
|
+
Release 0.8.3 - 2018/12/16
|
|
82
|
+
|
|
83
|
+
* output: Add ssl_client_cert_chain parameter
|
|
84
|
+
|
|
85
|
+
Release 0.8.2 - 2018/12/07
|
|
86
|
+
|
|
87
|
+
* output: Add idempotent parameter
|
|
88
|
+
* out_kafka2: Fix DeliveryFailed signature mismatch
|
|
89
|
+
|
|
90
|
+
Release 0.8.1 - 2018/11/20
|
|
91
|
+
|
|
92
|
+
* input: Support SASL without SSL
|
|
93
|
+
|
|
94
|
+
Release 0.8.0 - 2018/10/18
|
|
95
|
+
|
|
96
|
+
* output: Support SASL without SSL
|
|
97
|
+
* output: Add rdkafka based output
|
|
98
|
+
* Update ruby-kafka dependency to v0.7 or later
|
|
99
|
+
|
|
100
|
+
Release 0.7.9 - 2018/09/11
|
|
101
|
+
|
|
102
|
+
* in_kafka_group: Add fetcher_max_queue_size parameter
|
|
103
|
+
|
|
104
|
+
Release 0.7.8 - 2018/08/29
|
|
105
|
+
|
|
106
|
+
* input: Fix regression of kafka initialization
|
|
107
|
+
|
|
108
|
+
Release 0.7.7 - 2018/08/27
|
|
109
|
+
|
|
110
|
+
* in_kafka_group: Add retry_limit and disable_retry_limit parameters
|
|
111
|
+
* input: Support SSL parameters
|
|
112
|
+
* Add ssl_ca_certs_from_system parameter
|
|
113
|
+
* Make password parameter secret
|
|
114
|
+
|
|
115
|
+
Release 0.7.6 - 2018/08/15
|
|
116
|
+
|
|
117
|
+
* out_kafka2: Add ignore_exceptions and exception_backup parameters
|
|
118
|
+
|
|
119
|
+
Release 0.7.5 - 2018/08/14
|
|
120
|
+
|
|
121
|
+
* out_kafka2: Fix `message_key_key` parameter handling
|
|
122
|
+
* Limit ruby-kafka version('< 0.7.0') to avoid runtime error
|
|
123
|
+
|
|
124
|
+
Release 0.7.4 - 2018/07/11
|
|
125
|
+
|
|
126
|
+
* out_kafka2: Need event_emitter helper for notification
|
|
127
|
+
|
|
128
|
+
Release 0.7.3 - 2018/05/30
|
|
129
|
+
|
|
130
|
+
* output: Use SSL endpoint when ssl_client_cert is true
|
|
131
|
+
|
|
132
|
+
Release 0.7.2 - 2018/03/12
|
|
133
|
+
|
|
134
|
+
* output: Fix the regression of get_kafka_client_log parameter
|
|
135
|
+
|
|
136
|
+
Release 0.7.1 - 2018/03/05
|
|
137
|
+
|
|
138
|
+
* out_kafka2: Fix the regression of kafka client initialization
|
|
139
|
+
|
|
140
|
+
Release 0.7.0 - 2018/02/27
|
|
141
|
+
|
|
142
|
+
* output: SASL PLAIN/SCRAM support
|
|
143
|
+
* input: Fix TimeParser location bug in v1
|
|
144
|
+
* out_kafka2: Fix warning condition for tag chunk key
|
|
145
|
+
|
|
146
|
+
Release 0.6.6 - 2017/12/25
|
|
147
|
+
|
|
148
|
+
* output: Make topic/partition/partition_key/message_key configurable
|
|
149
|
+
|
|
150
|
+
Release 0.6.5 - 2017/12/14
|
|
151
|
+
|
|
152
|
+
* in_kafka_group: Add client_id parameter
|
|
153
|
+
|
|
154
|
+
Release 0.6.4 - 2017/11/23
|
|
155
|
+
|
|
156
|
+
* Multi worker support for v0.14
|
|
157
|
+
* Add kafka_message_key parameter to input plugins
|
|
158
|
+
* Relax ruby-kafka version for 0.5 or later
|
|
159
|
+
* Use oj for json when it is installed
|
|
160
|
+
|
|
161
|
+
Release 0.6.3 - 2017/11/14
|
|
162
|
+
|
|
163
|
+
* in_kafka_group: re-create consumer when error happens during event fetch
|
|
164
|
+
|
|
165
|
+
Release 0.6.2 - 2017/11/1
|
|
166
|
+
|
|
167
|
+
* Fix ltsv parsing issue which generates symbol keys
|
|
168
|
+
|
|
169
|
+
Release 0.6.1 - 2017/08/30
|
|
170
|
+
|
|
171
|
+
* Add stats and datadog monitoring support
|
|
172
|
+
* ssl_ca_certs now accepts multiple paths
|
|
173
|
+
* Fix bug by ruby-kafka 0.4.1 changes
|
|
174
|
+
* Update ruby-kafka dependency to v0.4.1
|
|
175
|
+
|
|
176
|
+
Release 0.6.0 - 2017/07/25
|
|
177
|
+
|
|
178
|
+
* Add principal and keytab parameters for SASL support
|
|
179
|
+
|
|
180
|
+
Release 0.5.7 - 2017/07/13
|
|
181
|
+
|
|
182
|
+
* out_kafka_buffered: Add kafka_agg_max_messages parameter
|
|
183
|
+
|
|
184
|
+
Release 0.5.6 - 2017/07/10
|
|
185
|
+
|
|
186
|
+
* output: Add ActiveSupport notification support
|
|
187
|
+
|
|
188
|
+
Release 0.5.5 - 2017/04/19
|
|
189
|
+
|
|
190
|
+
* output: Some trace log level changed to debug
|
|
191
|
+
* out_kafka_buffered: Add discard_kafka_delivery_failed parameter
|
|
192
|
+
|
|
193
|
+
Release 0.5.4 - 2017/04/12
|
|
194
|
+
|
|
195
|
+
* out_kafka_buffered: Add max_send_limit_bytes parameter
|
|
196
|
+
* out_kafka: Improve buffer overflow handling of ruby-kafka
|
|
197
|
+
|
|
198
|
+
Release 0.5.3 - 2017/02/13
|
|
199
|
+
|
|
200
|
+
* Relax ruby-kafka dependency
|
|
201
|
+
|
|
202
|
+
Release 0.5.2 - 2017/02/13
|
|
203
|
+
|
|
204
|
+
* in_kafka_group: Add max_bytes parameter
|
|
205
|
+
|
|
206
|
+
Release 0.5.1 - 2017/02/06
|
|
207
|
+
|
|
208
|
+
* in_kafka_group: Fix uninitialized constant error
|
|
209
|
+
|
|
210
|
+
Release 0.5.0 - 2017/01/17
|
|
211
|
+
|
|
212
|
+
* output: Add out_kafka2 plugin with v0.14 API
|
|
213
|
+
|
|
214
|
+
Release 0.4.2 - 2016/12/10
|
|
215
|
+
|
|
216
|
+
* input: Add use_record_time and time_format parameters
|
|
217
|
+
* Update ruby-kafka dependency to 0.3.16.beta2
|
|
218
|
+
|
|
219
|
+
Release 0.4.1 - 2016/12/01
|
|
220
|
+
|
|
221
|
+
* output: Support specifying partition
|
|
222
|
+
|
|
223
|
+
Release 0.4.0 - 2016/11/08
|
|
224
|
+
|
|
225
|
+
* Remove zookeeper dependency
|
|
226
|
+
|
|
227
|
+
Release 0.3.5 - 2016/10/21
|
|
228
|
+
|
|
229
|
+
* output: Support message key and related parameters. #91
|
|
230
|
+
|
|
231
|
+
Release 0.3.4 - 2016/10/20
|
|
232
|
+
|
|
233
|
+
* output: Add exclude_topic_key and exclude_partition_key. #89
|
|
234
|
+
|
|
235
|
+
Release 0.3.3 - 2016/10/17
|
|
236
|
+
|
|
237
|
+
* out_kafka_buffered: Add get_kafka_client_log parameter. #83
|
|
238
|
+
* out_kafka_buffered: Skip and log invalid record to avoid buffer stuck. #86
|
|
239
|
+
* in_kafka_group: Add retry_emit_limit to handle BufferQueueLimitError. #87
|
|
240
|
+
|
|
241
|
+
Release 0.3.2 - 2016/10/06
|
|
242
|
+
|
|
243
|
+
* in_kafka_group: Re-fetch events after consumer error. #79
|
|
244
|
+
|
|
245
|
+
Release 0.3.1 - 2016/08/28
|
|
246
|
+
|
|
247
|
+
* output: Change default required_acks to -1. #70
|
|
248
|
+
* Support ruby version changed to 2.1.0 or later
|
|
249
|
+
|
|
250
|
+
Release 0.3.0 - 2016/08/24
|
|
251
|
+
|
|
252
|
+
* Fully replace poseidon ruby library with ruby-kafka to support latest kafka versions
|
|
253
|
+
|
|
254
|
+
See git commits for older changes
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Copyright (C) 2014 htgc
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
# fluent-plugin-kafka, a plugin for [Fluentd](http://fluentd.org)
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/fluent/fluent-plugin-kafka)
|
|
4
|
+
|
|
5
|
+
A fluentd plugin to both consume and produce data for Apache Kafka.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
gem 'fluent-plugin-kafka'
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install fluent-plugin-kafka --no-document
|
|
20
|
+
|
|
21
|
+
If you want to use zookeeper related parameters, you also need to install zookeeper gem. zookeeper gem includes native extension, so development tools are needed, e.g. ruby-devel, gcc, make and etc.
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
- Ruby 2.1 or later
|
|
26
|
+
- Input plugins work with kafka v0.9 or later
|
|
27
|
+
- Output plugins work with kafka v0.8 or later
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Common parameters
|
|
32
|
+
|
|
33
|
+
#### SSL authentication
|
|
34
|
+
|
|
35
|
+
- ssl_ca_cert
|
|
36
|
+
- ssl_client_cert
|
|
37
|
+
- ssl_client_cert_key
|
|
38
|
+
- ssl_ca_certs_from_system
|
|
39
|
+
|
|
40
|
+
Set path to SSL related files. See [Encryption and Authentication using SSL](https://github.com/zendesk/ruby-kafka#encryption-and-authentication-using-ssl) for more detail.
|
|
41
|
+
|
|
42
|
+
#### SASL authentication
|
|
43
|
+
|
|
44
|
+
##### with GSSAPI
|
|
45
|
+
|
|
46
|
+
- principal
|
|
47
|
+
- keytab
|
|
48
|
+
|
|
49
|
+
Set principal and path to keytab for SASL/GSSAPI authentication.
|
|
50
|
+
See [Authentication using SASL](https://github.com/zendesk/ruby-kafka#authentication-using-sasl) for more details.
|
|
51
|
+
|
|
52
|
+
##### with Plain/SCRAM
|
|
53
|
+
|
|
54
|
+
- username
|
|
55
|
+
- password
|
|
56
|
+
- scram_mechanism
|
|
57
|
+
- sasl_over_ssl
|
|
58
|
+
|
|
59
|
+
Set username, password, scram_mechanism and sasl_over_ssl for SASL/Plain or Scram authentication.
|
|
60
|
+
See [Authentication using SASL](https://github.com/zendesk/ruby-kafka#authentication-using-sasl) for more details.
|
|
61
|
+
|
|
62
|
+
##### fetch auth info from GSM
|
|
63
|
+
- secretName
|
|
64
|
+
- projectId
|
|
65
|
+
- version :optional
|
|
66
|
+
|
|
67
|
+
***Requires GOOGLE_APPLICATION_CREDENTIALS env var to be set***
|
|
68
|
+
|
|
69
|
+
### Input plugin (@type 'kafka')
|
|
70
|
+
|
|
71
|
+
Consume events by single consumer.
|
|
72
|
+
|
|
73
|
+
<source>
|
|
74
|
+
@type kafka
|
|
75
|
+
|
|
76
|
+
brokers <broker1_host>:<broker1_port>,<broker2_host>:<broker2_port>,..
|
|
77
|
+
topics <listening topics(separate with comma',')>
|
|
78
|
+
format <input text type (text|json|ltsv|msgpack)> :default => json
|
|
79
|
+
message_key <key (Optional, for text format only, default is message)>
|
|
80
|
+
add_prefix <tag prefix (Optional)>
|
|
81
|
+
add_suffix <tag suffix (Optional)>
|
|
82
|
+
|
|
83
|
+
# Optionally, you can manage topic offset by using zookeeper
|
|
84
|
+
offset_zookeeper <zookeer node list (<zookeeper1_host>:<zookeeper1_port>,<zookeeper2_host>:<zookeeper2_port>,..)>
|
|
85
|
+
offset_zk_root_node <offset path in zookeeper> default => '/fluent-plugin-kafka'
|
|
86
|
+
|
|
87
|
+
# ruby-kafka consumer options
|
|
88
|
+
max_bytes (integer) :default => nil (Use default of ruby-kafka)
|
|
89
|
+
max_wait_time (integer) :default => nil (Use default of ruby-kafka)
|
|
90
|
+
min_bytes (integer) :default => nil (Use default of ruby-kafka)
|
|
91
|
+
</source>
|
|
92
|
+
|
|
93
|
+
Supports a start of processing from the assigned offset for specific topics.
|
|
94
|
+
|
|
95
|
+
<source>
|
|
96
|
+
@type kafka
|
|
97
|
+
|
|
98
|
+
brokers <broker1_host>:<broker1_port>,<broker2_host>:<broker2_port>,..
|
|
99
|
+
format <input text type (text|json|ltsv|msgpack)>
|
|
100
|
+
<topic>
|
|
101
|
+
topic <listening topic>
|
|
102
|
+
partition <listening partition: default=0>
|
|
103
|
+
offset <listening start offset: default=-1>
|
|
104
|
+
</topic>
|
|
105
|
+
<topic>
|
|
106
|
+
topic <listening topic>
|
|
107
|
+
partition <listening partition: default=0>
|
|
108
|
+
offset <listening start offset: default=-1>
|
|
109
|
+
</topic>
|
|
110
|
+
</source>
|
|
111
|
+
|
|
112
|
+
See also [ruby-kafka README](https://github.com/zendesk/ruby-kafka#consuming-messages-from-kafka) for more detailed documentation about ruby-kafka.
|
|
113
|
+
|
|
114
|
+
Consuming topic name is used for event tag. So when the target topic name is `app_event`, the tag is `app_event`. If you want to modify tag, use `add_prefix` or `add_suffix` parameters. With `add_prefix kafka`, the tag is `kafka.app_event`.
|
|
115
|
+
|
|
116
|
+
### Input plugin (@type 'kafka_group', supports kafka group)
|
|
117
|
+
|
|
118
|
+
Consume events by kafka consumer group features..
|
|
119
|
+
|
|
120
|
+
<source>
|
|
121
|
+
@type kafka_group
|
|
122
|
+
|
|
123
|
+
brokers <broker1_host>:<broker1_port>,<broker2_host>:<broker2_port>,..
|
|
124
|
+
consumer_group <consumer group name, must set>
|
|
125
|
+
topics <listening topics(separate with comma',')>
|
|
126
|
+
format <input text type (text|json|ltsv|msgpack)> :default => json
|
|
127
|
+
message_key <key (Optional, for text format only, default is message)>
|
|
128
|
+
add_prefix <tag prefix (Optional)>
|
|
129
|
+
add_suffix <tag suffix (Optional)>
|
|
130
|
+
retry_emit_limit <Wait retry_emit_limit x 1s when BuffereQueueLimitError happens. The default is nil and it means waiting until BufferQueueLimitError is resolved>
|
|
131
|
+
use_record_time (Deprecated. Use 'time_source record' instead.) <If true, replace event time with contents of 'time' field of fetched record>
|
|
132
|
+
time_source <source for message timestamp (now|kafka|record)> :default => now
|
|
133
|
+
time_format <string (Optional when use_record_time is used)>
|
|
134
|
+
|
|
135
|
+
# ruby-kafka consumer options
|
|
136
|
+
max_bytes (integer) :default => 1048576
|
|
137
|
+
max_wait_time (integer) :default => nil (Use default of ruby-kafka)
|
|
138
|
+
min_bytes (integer) :default => nil (Use default of ruby-kafka)
|
|
139
|
+
offset_commit_interval (integer) :default => nil (Use default of ruby-kafka)
|
|
140
|
+
offset_commit_threshold (integer) :default => nil (Use default of ruby-kafka)
|
|
141
|
+
fetcher_max_queue_size (integer) :default => nil (Use default of ruby-kafka)
|
|
142
|
+
start_from_beginning (bool) :default => true
|
|
143
|
+
</source>
|
|
144
|
+
|
|
145
|
+
See also [ruby-kafka README](https://github.com/zendesk/ruby-kafka#consuming-messages-from-kafka) for more detailed documentation about ruby-kafka options.
|
|
146
|
+
|
|
147
|
+
Consuming topic name is used for event tag. So when the target topic name is `app_event`, the tag is `app_event`. If you want to modify tag, use `add_prefix` or `add_suffix` parameter. With `add_prefix kafka`, the tag is `kafka.app_event`.
|
|
148
|
+
|
|
149
|
+
### Output plugin
|
|
150
|
+
|
|
151
|
+
This `kafka2` plugin is for fluentd v1.0 or later. This will be `out_kafka` plugin in the future.
|
|
152
|
+
|
|
153
|
+
<match app.**>
|
|
154
|
+
@type kafka2
|
|
155
|
+
|
|
156
|
+
brokers <broker1_host>:<broker1_port>,<broker2_host>:<broker2_port>,.. # Set brokers directly
|
|
157
|
+
topic_key (string) :default => 'topic'
|
|
158
|
+
partition_key (string) :default => 'partition'
|
|
159
|
+
partition_key_key (string) :default => 'partition_key'
|
|
160
|
+
message_key_key (string) :default => 'message_key'
|
|
161
|
+
default_topic (string) :default => nil
|
|
162
|
+
default_partition_key (string) :default => nil
|
|
163
|
+
default_message_key (string) :default => nil
|
|
164
|
+
exclude_topic_key (bool) :default => false
|
|
165
|
+
exclude_partition_key (bool) :default => false
|
|
166
|
+
exclude_partition (bool) :default => false
|
|
167
|
+
exclude_message_key (bool) :default => false
|
|
168
|
+
get_kafka_client_log (bool) :default => false
|
|
169
|
+
headers (hash) :default => {}
|
|
170
|
+
headers_from_record (hash) :default => {}
|
|
171
|
+
use_default_for_unknown_topic (bool) :default => false
|
|
172
|
+
|
|
173
|
+
<format>
|
|
174
|
+
@type (json|ltsv|msgpack|attr:<record name>|<formatter name>) :default => json
|
|
175
|
+
</format>
|
|
176
|
+
|
|
177
|
+
# Optional. See https://docs.fluentd.org/v/1.0/configuration/inject-section
|
|
178
|
+
<inject>
|
|
179
|
+
tag_key tag
|
|
180
|
+
time_key time
|
|
181
|
+
</inject>
|
|
182
|
+
|
|
183
|
+
# See fluentd document for buffer related parameters: https://docs.fluentd.org/v/1.0/configuration/buffer-section
|
|
184
|
+
# Buffer chunk key should be same with topic_key. If value is not found in the record, default_topic is used.
|
|
185
|
+
<buffer topic>
|
|
186
|
+
flush_interval 10s
|
|
187
|
+
</buffer>
|
|
188
|
+
|
|
189
|
+
# ruby-kafka producer options
|
|
190
|
+
idempotent (bool) :default => false
|
|
191
|
+
sasl_over_ssl (bool) :default => true
|
|
192
|
+
max_send_retries (integer) :default => 1
|
|
193
|
+
required_acks (integer) :default => -1
|
|
194
|
+
ack_timeout (integer) :default => nil (Use default of ruby-kafka)
|
|
195
|
+
compression_codec (string) :default => nil (No compression. Depends on ruby-kafka: https://github.com/zendesk/ruby-kafka#compression)
|
|
196
|
+
</match>
|
|
197
|
+
|
|
198
|
+
The `<formatter name>` in `<format>` uses fluentd's formatter plugins. See [formatter article](https://docs.fluentd.org/v/1.0/formatter).
|
|
199
|
+
|
|
200
|
+
ruby-kafka sometimes returns `Kafka::DeliveryFailed` error without good information.
|
|
201
|
+
In this case, `get_kafka_client_log` is useful for identifying the error cause.
|
|
202
|
+
ruby-kafka's log is routed to fluentd log so you can see ruby-kafka's log in fluentd logs.
|
|
203
|
+
|
|
204
|
+
Supports following ruby-kafka's producer options.
|
|
205
|
+
|
|
206
|
+
- max_send_retries - default: 1 - Number of times to retry sending of messages to a leader.
|
|
207
|
+
- required_acks - default: -1 - The number of acks required per request. If you need flush performance, set lower value, e.g. 1, 2.
|
|
208
|
+
- ack_timeout - default: nil - How long the producer waits for acks. The unit is seconds.
|
|
209
|
+
- compression_codec - default: nil - The codec the producer uses to compress messages.
|
|
210
|
+
- max_send_limit_bytes - default: nil - Max byte size to send message to avoid MessageSizeTooLarge. For example, if you set 1000000(message.max.bytes in kafka), Message more than 1000000 byes will be dropped.
|
|
211
|
+
- discard_kafka_delivery_failed - default: false - discard the record where [Kafka::DeliveryFailed](http://www.rubydoc.info/gems/ruby-kafka/Kafka/DeliveryFailed) occurred
|
|
212
|
+
- monitoring_list - default: [] - library to be used to monitor. statsd and datadog are supported
|
|
213
|
+
|
|
214
|
+
If you want to know about detail of monitoring, see also https://github.com/zendesk/ruby-kafka#monitoring
|
|
215
|
+
|
|
216
|
+
See also [Kafka::Client](http://www.rubydoc.info/gems/ruby-kafka/Kafka/Client) for more detailed documentation about ruby-kafka.
|
|
217
|
+
|
|
218
|
+
This plugin supports compression codec "snappy" also.
|
|
219
|
+
Install snappy module before you use snappy compression.
|
|
220
|
+
|
|
221
|
+
$ gem install snappy --no-document
|
|
222
|
+
|
|
223
|
+
snappy gem uses native extension, so you need to install several packages before.
|
|
224
|
+
On Ubuntu, need development packages and snappy library.
|
|
225
|
+
|
|
226
|
+
$ sudo apt-get install build-essential autoconf automake libtool libsnappy-dev
|
|
227
|
+
|
|
228
|
+
On CentOS 7 installation is also necessary.
|
|
229
|
+
|
|
230
|
+
$ sudo yum install gcc autoconf automake libtool snappy-devel
|
|
231
|
+
|
|
232
|
+
This plugin supports compression codec "lz4" also.
|
|
233
|
+
Install extlz4 module before you use lz4 compression.
|
|
234
|
+
|
|
235
|
+
$ gem install extlz4 --no-document
|
|
236
|
+
|
|
237
|
+
This plugin supports compression codec "zstd" also.
|
|
238
|
+
Install zstd-ruby module before you use zstd compression.
|
|
239
|
+
|
|
240
|
+
$ gem install zstd-ruby --no-document
|
|
241
|
+
|
|
242
|
+
#### Load balancing
|
|
243
|
+
|
|
244
|
+
Messages will be assigned a partition at random as default by ruby-kafka, but messages with the same partition key will always be assigned to the same partition by setting `default_partition_key` in config file.
|
|
245
|
+
If key name `partition_key_key` exists in a message, this plugin set the value of partition_key_key as key.
|
|
246
|
+
|
|
247
|
+
|default_partition_key|partition_key_key| behavior |
|
|
248
|
+
| --- | --- | --- |
|
|
249
|
+
|Not set|Not exists| All messages are assigned a partition at random |
|
|
250
|
+
|Set| Not exists| All messages are assigned to the specific partition |
|
|
251
|
+
|Not set| Exists | Messages which have partition_key_key record are assigned to the specific partition, others are assigned a partition at random |
|
|
252
|
+
|Set| Exists | Messages which have partition_key_key record are assigned to the specific partition with partition_key_key, others are assigned to the specific partition with default_parition_key |
|
|
253
|
+
|
|
254
|
+
If key name `message_key_key` exists in a message, this plugin publishes the value of message_key_key to kafka and can be read by consumers. Same message key will be assigned to all messages by setting `default_message_key` in config file. If message_key_key exists and if partition_key_key is not set explicitly, messsage_key_key will be used for partitioning.
|
|
255
|
+
|
|
256
|
+
#### Headers
|
|
257
|
+
It is possible to set headers on Kafka messages. This only works for kafka2 and rdkafka2 output plugin.
|
|
258
|
+
|
|
259
|
+
The format is like key1:value1,key2:value2. For example:
|
|
260
|
+
|
|
261
|
+
<match app.**>
|
|
262
|
+
@type kafka2
|
|
263
|
+
[...]
|
|
264
|
+
headers some_header_name:some_header_value
|
|
265
|
+
<match>
|
|
266
|
+
|
|
267
|
+
You may set header values based on a value of a fluentd record field. For example, imagine a fluentd record like:
|
|
268
|
+
|
|
269
|
+
{"source": { "ip": "127.0.0.1" }, "payload": "hello world" }
|
|
270
|
+
|
|
271
|
+
And the following fluentd config:
|
|
272
|
+
|
|
273
|
+
<match app.**>
|
|
274
|
+
@type kafka2
|
|
275
|
+
[...]
|
|
276
|
+
headers_from_record source_ip:$.source.ip
|
|
277
|
+
<match>
|
|
278
|
+
|
|
279
|
+
The Kafka message will have a header of source_ip=12.7.0.0.1.
|
|
280
|
+
|
|
281
|
+
The configuration format is jsonpath. It is descibed in https://docs.fluentd.org/plugin-helper-overview/api-plugin-helper-record_accessor
|
|
282
|
+
|
|
283
|
+
### Buffered output plugin
|
|
284
|
+
|
|
285
|
+
This plugin uses ruby-kafka producer for writing data. This plugin is for v0.12. If you use v1, see `kafka2`.
|
|
286
|
+
Support of fluentd v0.12 has ended. `kafka_buffered` will be an alias of `kafka2` and will be removed in the future.
|
|
287
|
+
|
|
288
|
+
<match app.**>
|
|
289
|
+
@type kafka_buffered
|
|
290
|
+
|
|
291
|
+
# Brokers: you can choose either brokers or zookeeper. If you are not familiar with zookeeper, use brokers parameters.
|
|
292
|
+
brokers <broker1_host>:<broker1_port>,<broker2_host>:<broker2_port>,.. # Set brokers directly
|
|
293
|
+
zookeeper <zookeeper_host>:<zookeeper_port> # Set brokers via Zookeeper
|
|
294
|
+
zookeeper_path <broker path in zookeeper> :default => /brokers/ids # Set path in zookeeper for kafka
|
|
295
|
+
|
|
296
|
+
topic_key (string) :default => 'topic'
|
|
297
|
+
partition_key (string) :default => 'partition'
|
|
298
|
+
partition_key_key (string) :default => 'partition_key'
|
|
299
|
+
message_key_key (string) :default => 'message_key'
|
|
300
|
+
default_topic (string) :default => nil
|
|
301
|
+
default_partition_key (string) :default => nil
|
|
302
|
+
default_message_key (string) :default => nil
|
|
303
|
+
exclude_topic_key (bool) :default => false
|
|
304
|
+
exclude_partition_key (bool) :default => false
|
|
305
|
+
exclude_partition (bool) :default => false
|
|
306
|
+
exclude_message_key (bool) :default => false
|
|
307
|
+
output_data_type (json|ltsv|msgpack|attr:<record name>|<formatter name>) :default => json
|
|
308
|
+
output_include_tag (bool) :default => false
|
|
309
|
+
output_include_time (bool) :default => false
|
|
310
|
+
exclude_topic_key (bool) :default => false
|
|
311
|
+
exclude_partition_key (bool) :default => false
|
|
312
|
+
get_kafka_client_log (bool) :default => false
|
|
313
|
+
|
|
314
|
+
# See fluentd document for buffer related parameters: https://docs.fluentd.org/v/0.12/buffer
|
|
315
|
+
|
|
316
|
+
# ruby-kafka producer options
|
|
317
|
+
idempotent (bool) :default => false
|
|
318
|
+
sasl_over_ssl (bool) :default => true
|
|
319
|
+
max_send_retries (integer) :default => 1
|
|
320
|
+
required_acks (integer) :default => -1
|
|
321
|
+
ack_timeout (integer) :default => nil (Use default of ruby-kafka)
|
|
322
|
+
compression_codec (string) :default => nil (No compression. Depends on ruby-kafka: https://github.com/zendesk/ruby-kafka#compression)
|
|
323
|
+
kafka_agg_max_bytes (integer) :default => 4096
|
|
324
|
+
kafka_agg_max_messages (integer) :default => nil (No limit)
|
|
325
|
+
max_send_limit_bytes (integer) :default => nil (No drop)
|
|
326
|
+
discard_kafka_delivery_failed (bool) :default => false (No discard)
|
|
327
|
+
monitoring_list (array) :default => []
|
|
328
|
+
</match>
|
|
329
|
+
|
|
330
|
+
`kafka_buffered` has two additional parameters:
|
|
331
|
+
|
|
332
|
+
- kafka_agg_max_bytes - default: 4096 - Maximum value of total message size to be included in one batch transmission.
|
|
333
|
+
- kafka_agg_max_messages - default: nil - Maximum number of messages to include in one batch transmission.
|
|
334
|
+
|
|
335
|
+
### Non-buffered output plugin
|
|
336
|
+
|
|
337
|
+
This plugin uses ruby-kafka producer for writing data. For performance and reliability concerns, use `kafka_bufferd` output instead. This is mainly for testing.
|
|
338
|
+
|
|
339
|
+
<match app.**>
|
|
340
|
+
@type kafka
|
|
341
|
+
|
|
342
|
+
# Brokers: you can choose either brokers or zookeeper.
|
|
343
|
+
brokers <broker1_host>:<broker1_port>,<broker2_host>:<broker2_port>,.. # Set brokers directly
|
|
344
|
+
zookeeper <zookeeper_host>:<zookeeper_port> # Set brokers via Zookeeper
|
|
345
|
+
zookeeper_path <broker path in zookeeper> :default => /brokers/ids # Set path in zookeeper for kafka
|
|
346
|
+
|
|
347
|
+
default_topic (string) :default => nil
|
|
348
|
+
default_partition_key (string) :default => nil
|
|
349
|
+
default_message_key (string) :default => nil
|
|
350
|
+
output_data_type (json|ltsv|msgpack|attr:<record name>|<formatter name>) :default => json
|
|
351
|
+
output_include_tag (bool) :default => false
|
|
352
|
+
output_include_time (bool) :default => false
|
|
353
|
+
exclude_topic_key (bool) :default => false
|
|
354
|
+
exclude_partition_key (bool) :default => false
|
|
355
|
+
|
|
356
|
+
# ruby-kafka producer options
|
|
357
|
+
max_send_retries (integer) :default => 1
|
|
358
|
+
required_acks (integer) :default => -1
|
|
359
|
+
ack_timeout (integer) :default => nil (Use default of ruby-kafka)
|
|
360
|
+
compression_codec (string) :default => nil (No compression. Depends on ruby-kafka: https://github.com/zendesk/ruby-kafka#compression)
|
|
361
|
+
max_buffer_size (integer) :default => nil (Use default of ruby-kafka)
|
|
362
|
+
max_buffer_bytesize (integer) :default => nil (Use default of ruby-kafka)
|
|
363
|
+
</match>
|
|
364
|
+
|
|
365
|
+
This plugin also supports ruby-kafka related parameters. See Buffered output plugin section.
|
|
366
|
+
|
|
367
|
+
### rdkafka based output plugin
|
|
368
|
+
|
|
369
|
+
This plugin uses `rdkafka` instead of `ruby-kafka` for kafka client.
|
|
370
|
+
You need to install rdkafka gem.
|
|
371
|
+
|
|
372
|
+
# rdkafka is C extension library. Need to install development tools like ruby-devel, gcc and etc
|
|
373
|
+
# for v0.12 or later
|
|
374
|
+
$ gem install rdkafka --no-document
|
|
375
|
+
# for v0.11 or earlier
|
|
376
|
+
$ gem install rdkafka -v 0.6.0 --no-document
|
|
377
|
+
|
|
378
|
+
`rdkafka2` is for fluentd v1.0 or later.
|
|
379
|
+
|
|
380
|
+
<match app.**>
|
|
381
|
+
@type rdkafka2
|
|
382
|
+
|
|
383
|
+
brokers <broker1_host>:<broker1_port>,<broker2_host>:<broker2_port>,.. # Set brokers directly
|
|
384
|
+
|
|
385
|
+
topic_key (string) :default => 'topic'
|
|
386
|
+
default_topic (string) :default => nil
|
|
387
|
+
partition_key (string) :default => 'partition'
|
|
388
|
+
partition_key_key (string) :default => 'partition_key'
|
|
389
|
+
message_key_key (string) :default => 'message_key'
|
|
390
|
+
default_topic (string) :default => nil
|
|
391
|
+
default_partition_key (string) :default => nil
|
|
392
|
+
default_message_key (string) :default => nil
|
|
393
|
+
exclude_topic_key (bool) :default => false
|
|
394
|
+
exclude_partition_key (bool) :default => false
|
|
395
|
+
|
|
396
|
+
# same with kafka2
|
|
397
|
+
headers (hash) :default => {}
|
|
398
|
+
headers_from_record (hash) :default => {}
|
|
399
|
+
|
|
400
|
+
<format>
|
|
401
|
+
@type (json|ltsv|msgpack|attr:<record name>|<formatter name>) :default => json
|
|
402
|
+
</format>
|
|
403
|
+
|
|
404
|
+
# Optional. See https://docs.fluentd.org/v/1.0/configuration/inject-section
|
|
405
|
+
<inject>
|
|
406
|
+
tag_key tag
|
|
407
|
+
time_key time
|
|
408
|
+
</inject>
|
|
409
|
+
|
|
410
|
+
# See fluentd document for buffer section parameters: https://docs.fluentd.org/v/1.0/configuration/buffer-section
|
|
411
|
+
# Buffer chunk key should be same with topic_key. If value is not found in the record, default_topic is used.
|
|
412
|
+
<buffer topic>
|
|
413
|
+
flush_interval 10s
|
|
414
|
+
</buffer>
|
|
415
|
+
|
|
416
|
+
# You can set any rdkafka configuration via this parameter: https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md
|
|
417
|
+
rdkafka_options {
|
|
418
|
+
"log_level" : 7
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
# rdkafka2 specific parameters
|
|
422
|
+
|
|
423
|
+
# share kafka producer between flush threads. This is mainly for reducing kafka operations like kerberos
|
|
424
|
+
share_producer (bool) :default => false
|
|
425
|
+
# Timeout for polling message wait. If 0, no wait.
|
|
426
|
+
rdkafka_delivery_handle_poll_timeout (integer) :default => 30
|
|
427
|
+
# If the record size is larger than this value, such records are ignored. Default is no limit
|
|
428
|
+
max_send_limit_bytes (integer) :default => nil
|
|
429
|
+
</match>
|
|
430
|
+
|
|
431
|
+
If you use v0.12, use `rdkafka` instead.
|
|
432
|
+
|
|
433
|
+
<match kafka.**>
|
|
434
|
+
@type rdkafka
|
|
435
|
+
|
|
436
|
+
default_topic kafka
|
|
437
|
+
flush_interval 1s
|
|
438
|
+
output_data_type json
|
|
439
|
+
|
|
440
|
+
rdkafka_options {
|
|
441
|
+
"log_level" : 7
|
|
442
|
+
}
|
|
443
|
+
</match>
|
|
444
|
+
|
|
445
|
+
## FAQ
|
|
446
|
+
|
|
447
|
+
### Why fluent-plugin-kafka can't send data to our kafka cluster?
|
|
448
|
+
|
|
449
|
+
We got lots of similar questions. Almost cases, this problem happens by version mismatch between ruby-kafka and kafka cluster.
|
|
450
|
+
See ruby-kafka README for more details: https://github.com/zendesk/ruby-kafka#compatibility
|
|
451
|
+
|
|
452
|
+
To avoid the problem, there are 2 approaches:
|
|
453
|
+
|
|
454
|
+
- Upgrade your kafka cluster to latest version. This is better becase recent version is faster and robust.
|
|
455
|
+
- Downgrade ruby-kafka/fluent-plugin-kafka to work with your older kafka.
|
|
456
|
+
|
|
457
|
+
## Contributing
|
|
458
|
+
|
|
459
|
+
1. Fork it
|
|
460
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
461
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
462
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
463
|
+
5. Create new Pull Request
|