logstash-integration-kafka 10.2.0-java → 10.5.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88d87b3c5b9e443c0bc4ba8064b6316243f24bb0c0d6ce150ca0a19dd25ecb2a
4
- data.tar.gz: 5fc09468e8cdc7094bc6099c24d70b1c19bc339c3ec3dfa3562e0c389fa85753
3
+ metadata.gz: 877f38709d9280199d61c2c7755461223a9695bd966d8d7ad77676b40c071102
4
+ data.tar.gz: 34d9f91fc7ae51cc4419ef19ada731b8a122006338371daf0d5c6b23c692a46c
5
5
  SHA512:
6
- metadata.gz: 4e0fc4586ca91967e9f8afa4a2eef95b7a5f8cd13f3b6689b4ace12b64d3ea628bc5112735d54edcb20c0fe1c6debac1e4d32983e1555eb9a84d380ab5d68a4e
7
- data.tar.gz: 10ae655222832b9b5f6b9d8aa155d0907da91e38f04c7ad74c949d7bf4c8ff5d222bde6b2e1779eca5bd4bebb99aaf54701c8e2fddd4cb5a3cff47fabe9831fe
6
+ metadata.gz: e1587ee36b4e8038c17c8ed9182d7e25e040447df017917bc4b8dc69f1ffe0c3ab9c624bccabe6ba4439d9ac7ffa38dfab417ac93ee46e0aef6308a303ba5dee
7
+ data.tar.gz: 45c48cf5e734e86e9454b4084a83289d89ae51613d100c8b02587d7be4ce9914cb7956b0a2fa51bfd1dea2d9929081becf9ebc1c5f90cf4e03d6076bf3ed8f63
@@ -1,3 +1,23 @@
1
+ ## 10.5.2
2
+ - Docs: explain group_id in case of multiple inputs [#59](https://github.com/logstash-plugins/logstash-integration-kafka/pull/59)
3
+
4
+ ## 10.5.1
5
+ - [DOC]Replaced plugin_header file with plugin_header-integration file. [#46](https://github.com/logstash-plugins/logstash-integration-kafka/pull/46)
6
+ - [DOC]Update kafka client version across kafka integration docs [#47](https://github.com/logstash-plugins/logstash-integration-kafka/pull/47)
7
+ - [DOC]Replace hard-coded kafka client and doc path version numbers with attributes to simplify doc maintenance [#48](https://github.com/logstash-plugins/logstash-integration-kafka/pull/48)
8
+
9
+ ## 10.5.0
10
+ - Changed: retry sending messages only for retriable exceptions [#27](https://github.com/logstash-plugins/logstash-integration-kafka/pull/29)
11
+
12
+ ## 10.4.1
13
+ - [DOC] Fixed formatting issues and made minor content edits [#43](https://github.com/logstash-plugins/logstash-integration-kafka/pull/43)
14
+
15
+ ## 10.4.0
16
+ - added the input `isolation_level` to allow fine control of whether to return transactional messages [#44](https://github.com/logstash-plugins/logstash-integration-kafka/pull/44)
17
+
18
+ ## 10.3.0
19
+ - added the input and output `client_dns_lookup` parameter to allow control of how DNS requests are made [#28](https://github.com/logstash-plugins/logstash-integration-kafka/pull/28)
20
+
1
21
  ## 10.2.0
2
22
  - Changed: config defaults to be aligned with Kafka client defaults [#30](https://github.com/logstash-plugins/logstash-integration-kafka/pull/30)
3
23
 
@@ -12,6 +12,7 @@ Contributors:
12
12
  * Kurt Hurtado (kurtado)
13
13
  * Ry Biesemeyer (yaauie)
14
14
  * Rob Cowart (robcowart)
15
+ * Tim te Beek (timtebeek)
15
16
 
16
17
  Note: If you've sent us patches, bug reports, or otherwise contributed to
17
18
  Logstash, and you aren't on the list above and want to be, please let us know
@@ -1,6 +1,7 @@
1
1
  :plugin: kafka
2
2
  :type: integration
3
3
  :no_codec:
4
+ :kafka_client: 2.4
4
5
 
5
6
  ///////////////////////////////////////////
6
7
  START - GENERATED VARIABLES, DO NOT EDIT!
@@ -21,11 +22,15 @@ include::{include_path}/plugin_header.asciidoc[]
21
22
 
22
23
  ==== Description
23
24
 
24
- The Kafka Integration Plugin provides integrated plugins for working with the https://kafka.apache.org/[Kafka] distributed streaming platform.
25
+ The Kafka Integration Plugin provides integrated plugins for working with the
26
+ https://kafka.apache.org/[Kafka] distributed streaming platform.
25
27
 
26
28
  - {logstash-ref}/plugins-inputs-kafka.html[Kafka Input Plugin]
27
29
  - {logstash-ref}/plugins-outputs-kafka.html[Kafka Output Plugin]
28
30
 
29
- This plugin uses Kafka Client 2.4. For broker compatibility, see the official https://cwiki.apache.org/confluence/display/KAFKA/Compatibility+Matrix[Kafka compatibility reference]. If the linked compatibility wiki is not up-to-date, please contact Kafka support/community to confirm compatibility.
31
+ This plugin uses Kafka Client {kafka_client}. For broker compatibility, see the official
32
+ https://cwiki.apache.org/confluence/display/KAFKA/Compatibility+Matrix[Kafka
33
+ compatibility reference]. If the linked compatibility wiki is not up-to-date,
34
+ please contact Kafka support/community to confirm compatibility.
30
35
 
31
36
  :no_codec!:
@@ -1,6 +1,9 @@
1
+ :integration: kafka
1
2
  :plugin: kafka
2
3
  :type: input
3
4
  :default_codec: plain
5
+ :kafka_client: 2.4
6
+ :kafka_client_doc: 24
4
7
 
5
8
  ///////////////////////////////////////////
6
9
  START - GENERATED VARIABLES, DO NOT EDIT!
@@ -17,15 +20,20 @@ END - GENERATED VARIABLES, DO NOT EDIT!
17
20
 
18
21
  === Kafka input plugin
19
22
 
20
- include::{include_path}/plugin_header.asciidoc[]
23
+ include::{include_path}/plugin_header-integration.asciidoc[]
21
24
 
22
25
  ==== Description
23
26
 
24
27
  This input will read events from a Kafka topic.
25
28
 
26
- This plugin uses Kafka Client 2.1.0. For broker compatibility, see the official https://cwiki.apache.org/confluence/display/KAFKA/Compatibility+Matrix[Kafka compatibility reference]. If the linked compatibility wiki is not up-to-date, please contact Kafka support/community to confirm compatibility.
29
+ This plugin uses Kafka Client {kafka_client}. For broker compatibility, see the
30
+ official
31
+ https://cwiki.apache.org/confluence/display/KAFKA/Compatibility+Matrix[Kafka
32
+ compatibility reference]. If the linked compatibility wiki is not up-to-date,
33
+ please contact Kafka support/community to confirm compatibility.
27
34
 
28
- If you require features not yet available in this plugin (including client version upgrades), please file an issue with details about what you need.
35
+ If you require features not yet available in this plugin (including client
36
+ version upgrades), please file an issue with details about what you need.
29
37
 
30
38
  This input supports connecting to Kafka over:
31
39
 
@@ -46,9 +54,9 @@ the same `group_id`.
46
54
  Ideally you should have as many threads as the number of partitions for a perfect balance --
47
55
  more threads than partitions means that some threads will be idle
48
56
 
49
- For more information see https://kafka.apache.org/24/documentation.html#theconsumer
57
+ For more information see https://kafka.apache.org/{kafka_client_doc}/documentation.html#theconsumer
50
58
 
51
- Kafka consumer configuration: https://kafka.apache.org/24/documentation.html#consumerconfigs
59
+ Kafka consumer configuration: https://kafka.apache.org/{kafka_client_doc}/documentation.html#consumerconfigs
52
60
 
53
61
  ==== Metadata fields
54
62
 
@@ -59,7 +67,11 @@ The following metadata from Kafka broker are added under the `[@metadata]` field
59
67
  * `[@metadata][kafka][partition]`: Partition info for this message.
60
68
  * `[@metadata][kafka][offset]`: Original record offset for this message.
61
69
  * `[@metadata][kafka][key]`: Record key, if any.
62
- * `[@metadata][kafka][timestamp]`: Timestamp in the Record. Depending on your broker configuration, this can be either when the record was created (default) or when it was received by the broker. See more about property log.message.timestamp.type at https://kafka.apache.org/10/documentation.html#brokerconfigs
70
+ * `[@metadata][kafka][timestamp]`: Timestamp in the Record.
71
+ Depending on your broker configuration, this can be
72
+ either when the record was created (default) or when it was received by the
73
+ broker. See more about property log.message.timestamp.type at
74
+ https://kafka.apache.org/{kafka_client_doc}/documentation.html#brokerconfigs
63
75
 
64
76
  Metadata is only added to the event if the `decorate_events` option is set to true (it defaults to false).
65
77
 
@@ -73,7 +85,7 @@ This plugin supports these configuration options plus the <<plugins-{type}s-{plu
73
85
 
74
86
  NOTE: Some of these options map to a Kafka option. Defaults usually reflect the Kafka default setting,
75
87
  and might change if Kafka's consumer defaults change.
76
- See the https://kafka.apache.org/24/documentation for more details.
88
+ See the https://kafka.apache.org/{kafka_client_doc}/documentation for more details.
77
89
 
78
90
  [cols="<,<,<",options="header",]
79
91
  |=======================================================================
@@ -82,6 +94,7 @@ See the https://kafka.apache.org/24/documentation for more details.
82
94
  | <<plugins-{type}s-{plugin}-auto_offset_reset>> |<<string,string>>|No
83
95
  | <<plugins-{type}s-{plugin}-bootstrap_servers>> |<<string,string>>|No
84
96
  | <<plugins-{type}s-{plugin}-check_crcs>> |<<boolean,boolean>>|No
97
+ | <<plugins-{type}s-{plugin}-client_dns_lookup>> |<<string,string>>|No
85
98
  | <<plugins-{type}s-{plugin}-client_id>> |<<string,string>>|No
86
99
  | <<plugins-{type}s-{plugin}-client_rack>> |<<string,string>>|No
87
100
  | <<plugins-{type}s-{plugin}-connections_max_idle_ms>> |<<number,number>>|No
@@ -94,6 +107,7 @@ See the https://kafka.apache.org/24/documentation for more details.
94
107
  | <<plugins-{type}s-{plugin}-fetch_min_bytes>> |<<number,number>>|No
95
108
  | <<plugins-{type}s-{plugin}-group_id>> |<<string,string>>|No
96
109
  | <<plugins-{type}s-{plugin}-heartbeat_interval_ms>> |<<number,number>>|No
110
+ | <<plugins-{type}s-{plugin}-isolation_level>> |<<string,string>>|No
97
111
  | <<plugins-{type}s-{plugin}-jaas_path>> |a valid filesystem path|No
98
112
  | <<plugins-{type}s-{plugin}-kerberos_config>> |a valid filesystem path|No
99
113
  | <<plugins-{type}s-{plugin}-key_deserializer_class>> |<<string,string>>|No
@@ -174,6 +188,17 @@ Automatically check the CRC32 of the records consumed.
174
188
  This ensures no on-the-wire or on-disk corruption to the messages occurred.
175
189
  This check adds some overhead, so it may be disabled in cases seeking extreme performance.
176
190
 
191
+ [id="plugins-{type}s-{plugin}-client_dns_lookup"]
192
+ ===== `client_dns_lookup`
193
+
194
+ * Value type is <<string,string>>
195
+ * Default value is `"default"`
196
+
197
+ How DNS lookups should be done. If set to `use_all_dns_ips`, when the lookup returns multiple
198
+ IP addresses for a hostname, they will all be attempted to connect to before failing the
199
+ connection. If the value is `resolve_canonical_bootstrap_servers_only` each entry will be
200
+ resolved and expanded into a list of canonical names.
201
+
177
202
  [id="plugins-{type}s-{plugin}-client_id"]
178
203
  ===== `client_id`
179
204
 
@@ -289,7 +314,11 @@ before answering the request.
289
314
 
290
315
  The identifier of the group this consumer belongs to. Consumer group is a single logical subscriber
291
316
  that happens to be made up of multiple processors. Messages in a topic will be distributed to all
292
- Logstash instances with the same `group_id`
317
+ Logstash instances with the same `group_id`.
318
+
319
+ NOTE: In cases when multiple inputs are being used in a single pipeline, reading from different topics,
320
+ it's essential to set a different `group_id => ...` for each input. Setting a unique `client_id => ...`
321
+ is also recommended.
293
322
 
294
323
  [id="plugins-{type}s-{plugin}-heartbeat_interval_ms"]
295
324
  ===== `heartbeat_interval_ms`
@@ -303,6 +332,17 @@ consumers join or leave the group. The value must be set lower than
303
332
  `session.timeout.ms`, but typically should be set no higher than 1/3 of that value.
304
333
  It can be adjusted even lower to control the expected time for normal rebalances.
305
334
 
335
+ [id="plugins-{type}s-{plugin}-isolation_level"]
336
+ ===== `isolation_level`
337
+
338
+ * Value type is <<string,string>>
339
+ * Default value is `"read_uncommitted"`
340
+
341
+ Controls how to read messages written transactionally. If set to `read_committed`, polling messages will only return
342
+ transactional messages which have been committed. If set to `read_uncommitted` (the default), polling messages will
343
+ return all messages, even transactional messages which have been aborted. Non-transactional messages will be returned
344
+ unconditionally in either mode.
345
+
306
346
  [id="plugins-{type}s-{plugin}-jaas_path"]
307
347
  ===== `jaas_path`
308
348
 
@@ -397,7 +437,7 @@ partition ownership amongst consumer instances, supported options are:
397
437
  * `sticky`
398
438
  * `cooperative_sticky`
399
439
 
400
- These map to Kafka's corresponding https://kafka.apache.org/24/javadoc/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.html[`ConsumerPartitionAssignor`]
440
+ These map to Kafka's corresponding https://kafka.apache.org/{kafka_client_doc}/javadoc/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.html[`ConsumerPartitionAssignor`]
401
441
  implementations.
402
442
 
403
443
  [id="plugins-{type}s-{plugin}-poll_timeout_ms"]
@@ -1,6 +1,9 @@
1
+ :integration: kafka
1
2
  :plugin: kafka
2
3
  :type: output
3
4
  :default_codec: plain
5
+ :kafka_client: 2.4
6
+ :kafka_client_doc: 24
4
7
 
5
8
  ///////////////////////////////////////////
6
9
  START - GENERATED VARIABLES, DO NOT EDIT!
@@ -17,15 +20,20 @@ END - GENERATED VARIABLES, DO NOT EDIT!
17
20
 
18
21
  === Kafka output plugin
19
22
 
20
- include::{include_path}/plugin_header.asciidoc[]
23
+ include::{include_path}/plugin_header-integration.asciidoc[]
21
24
 
22
25
  ==== Description
23
26
 
24
27
  Write events to a Kafka topic.
25
28
 
26
- This plugin uses Kafka Client 2.1.0. For broker compatibility, see the official https://cwiki.apache.org/confluence/display/KAFKA/Compatibility+Matrix[Kafka compatibility reference]. If the linked compatibility wiki is not up-to-date, please contact Kafka support/community to confirm compatibility.
29
+ This plugin uses Kafka Client {kafka_client}. For broker compatibility, see the
30
+ official
31
+ https://cwiki.apache.org/confluence/display/KAFKA/Compatibility+Matrix[Kafka
32
+ compatibility reference]. If the linked compatibility wiki is not up-to-date,
33
+ please contact Kafka support/community to confirm compatibility.
27
34
 
28
- If you require features not yet available in this plugin (including client version upgrades), please file an issue with details about what you need.
35
+ If you require features not yet available in this plugin (including client
36
+ version upgrades), please file an issue with details about what you need.
29
37
 
30
38
  This output supports connecting to Kafka over:
31
39
 
@@ -36,9 +44,12 @@ By default security is disabled but can be turned on as needed.
36
44
 
37
45
  The only required configuration is the topic_id.
38
46
 
39
- The default codec is plain. Logstash will encode your events with not only the message field but also with a timestamp and hostname.
47
+ The default codec is plain. Logstash will encode your events with not only the
48
+ message field but also with a timestamp and hostname.
49
+
50
+ If you want the full content of your events to be sent as json, you should set
51
+ the codec in the output configuration like this:
40
52
 
41
- If you want the full content of your events to be sent as json, you should set the codec in the output configuration like this:
42
53
  [source,ruby]
43
54
  output {
44
55
  kafka {
@@ -47,9 +58,11 @@ If you want the full content of your events to be sent as json, you should set t
47
58
  }
48
59
  }
49
60
 
50
- For more information see https://kafka.apache.org/24/documentation.html#theproducer
61
+ For more information see
62
+ https://kafka.apache.org/{kafka_client_doc}/documentation.html#theproducer
51
63
 
52
- Kafka producer configuration: https://kafka.apache.org/24/documentation.html#producerconfigs
64
+ Kafka producer configuration:
65
+ https://kafka.apache.org/{kafka_client_doc}/documentation.html#producerconfigs
53
66
 
54
67
  [id="plugins-{type}s-{plugin}-options"]
55
68
  ==== Kafka Output Configuration Options
@@ -58,7 +71,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
58
71
 
59
72
  NOTE: Some of these options map to a Kafka option. Defaults usually reflect the Kafka default setting,
60
73
  and might change if Kafka's producer defaults change.
61
- See the https://kafka.apache.org/24/documentation for more details.
74
+ See the https://kafka.apache.org/{kafka_client_doc}/documentation for more details.
62
75
 
63
76
  [cols="<,<,<",options="header",]
64
77
  |=======================================================================
@@ -67,6 +80,7 @@ See the https://kafka.apache.org/24/documentation for more details.
67
80
  | <<plugins-{type}s-{plugin}-batch_size>> |<<number,number>>|No
68
81
  | <<plugins-{type}s-{plugin}-bootstrap_servers>> |<<string,string>>|No
69
82
  | <<plugins-{type}s-{plugin}-buffer_memory>> |<<number,number>>|No
83
+ | <<plugins-{type}s-{plugin}-client_dns_lookup>> |<<string,string>>|No
70
84
  | <<plugins-{type}s-{plugin}-client_id>> |<<string,string>>|No
71
85
  | <<plugins-{type}s-{plugin}-compression_type>> |<<string,string>>, one of `["none", "gzip", "snappy", "lz4"]`|No
72
86
  | <<plugins-{type}s-{plugin}-jaas_path>> |a valid filesystem path|No
@@ -114,10 +128,13 @@ output plugins.
114
128
  The number of acknowledgments the producer requires the leader to have received
115
129
  before considering a request complete.
116
130
 
117
- acks=0, the producer will not wait for any acknowledgment from the server at all.
118
- acks=1, This will mean the leader will write the record to its local log but
119
- will respond without awaiting full acknowledgement from all followers.
120
- acks=all, This means the leader will wait for the full set of in-sync replicas to acknowledge the record.
131
+ `acks=0`. The producer will not wait for any acknowledgment from the server.
132
+
133
+ `acks=1`. The leader will write the record to its local log, but will respond
134
+ without waiting for full acknowledgement from all followers.
135
+
136
+ `acks=all`. The leader will wait for the full set of in-sync replicas before
137
+ acknowledging the record.
121
138
 
122
139
  [id="plugins-{type}s-{plugin}-batch_size"]
123
140
  ===== `batch_size`
@@ -149,6 +166,18 @@ subset of brokers.
149
166
 
150
167
  The total bytes of memory the producer can use to buffer records waiting to be sent to the server.
151
168
 
169
+ [id="plugins-{type}s-{plugin}-client_dns_lookup"]
170
+ ===== `client_dns_lookup`
171
+
172
+ * Value type is <<string,string>>
173
+ * Valid options are `use_all_dns_ips`, `resolve_canonical_bootstrap_servers_only`, `default`
174
+ * Default value is `"default"`
175
+
176
+ Controls how DNS lookups are done. If set to `use_all_dns_ips`, Logstash tries
177
+ all IP addresses returned for a hostname before failing the connection.
178
+ If set to `resolve_canonical_bootstrap_servers_only`, each entry will be
179
+ resolved and expanded into a list of canonical names.
180
+
152
181
  [id="plugins-{type}s-{plugin}-client_id"]
153
182
  ===== `client_id`
154
183
 
@@ -166,7 +195,7 @@ ip/port by allowing a logical application name to be included with the request
166
195
  * Default value is `"none"`
167
196
 
168
197
  The compression type for all data generated by the producer.
169
- The default is none (i.e. no compression). Valid values are none, gzip, or snappy.
198
+ The default is none (i.e. no compression). Valid values are none, gzip, snappy, or lz4.
170
199
 
171
200
  [id="plugins-{type}s-{plugin}-jaas_path"]
172
201
  ===== `jaas_path`
@@ -311,6 +340,15 @@ Kafka down, etc).
311
340
 
312
341
  A value less than zero is a configuration error.
313
342
 
343
+ Starting with version 10.5.0, this plugin will only retry exceptions that are a subclass of
344
+ https://kafka.apache.org/{kafka_client_doc}/javadoc/org/apache/kafka/common/errors/RetriableException.html[RetriableException]
345
+ and
346
+ https://kafka.apache.org/{kafka_client_doc}/javadoc/org/apache/kafka/common/errors/InterruptException.html[InterruptException].
347
+ If producing a message throws any other exception, an error is logged and the message is dropped without retrying.
348
+ This prevents the Logstash pipeline from hanging indefinitely.
349
+
350
+ In versions prior to 10.5.0, any exception is retried indefinitely unless the `retries` option is configured.
351
+
314
352
  [id="plugins-{type}s-{plugin}-retry_backoff_ms"]
315
353
  ===== `retry_backoff_ms`
316
354
 
@@ -71,6 +71,11 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
71
71
  # corruption to the messages occurred. This check adds some overhead, so it may be
72
72
  # disabled in cases seeking extreme performance.
73
73
  config :check_crcs, :validate => :boolean, :default => true
74
+ # How DNS lookups should be done. If set to `use_all_dns_ips`, when the lookup returns multiple
75
+ # IP addresses for a hostname, they will all be attempted to connect to before failing the
76
+ # connection. If the value is `resolve_canonical_bootstrap_servers_only` each entry will be
77
+ # resolved and expanded into a list of canonical names.
78
+ config :client_dns_lookup, :validate => ["default", "use_all_dns_ips", "resolve_canonical_bootstrap_servers_only"], :default => "default"
74
79
  # The id string to pass to the server when making requests. The purpose of this
75
80
  # is to be able to track the source of requests beyond just ip/port by allowing
76
81
  # a logical application name to be included.
@@ -109,6 +114,11 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
109
114
  # `session.timeout.ms`, but typically should be set no higher than 1/3 of that value.
110
115
  # It can be adjusted even lower to control the expected time for normal rebalances.
111
116
  config :heartbeat_interval_ms, :validate => :number, :default => 3000 # Kafka default
117
+ # Controls how to read messages written transactionally. If set to read_committed, consumer.poll()
118
+ # will only return transactional messages which have been committed. If set to read_uncommitted'
119
+ # (the default), consumer.poll() will return all messages, even transactional messages which have
120
+ # been aborted. Non-transactional messages will be returned unconditionally in either mode.
121
+ config :isolation_level, :validate => ["read_uncommitted", "read_committed"], :default => "read_uncommitted" # Kafka default
112
122
  # Java Class used to deserialize the record's key
113
123
  config :key_deserializer_class, :validate => :string, :default => "org.apache.kafka.common.serialization.StringDeserializer"
114
124
  # The maximum delay between invocations of poll() when using consumer group management. This places
@@ -296,6 +306,7 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
296
306
  props.put(kafka::AUTO_OFFSET_RESET_CONFIG, auto_offset_reset) unless auto_offset_reset.nil?
297
307
  props.put(kafka::BOOTSTRAP_SERVERS_CONFIG, bootstrap_servers)
298
308
  props.put(kafka::CHECK_CRCS_CONFIG, check_crcs.to_s) unless check_crcs.nil?
309
+ props.put(kafka::CLIENT_DNS_LOOKUP_CONFIG, client_dns_lookup)
299
310
  props.put(kafka::CLIENT_ID_CONFIG, client_id)
300
311
  props.put(kafka::CONNECTIONS_MAX_IDLE_MS_CONFIG, connections_max_idle_ms.to_s) unless connections_max_idle_ms.nil?
301
312
  props.put(kafka::ENABLE_AUTO_COMMIT_CONFIG, enable_auto_commit.to_s)
@@ -305,6 +316,7 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
305
316
  props.put(kafka::FETCH_MIN_BYTES_CONFIG, fetch_min_bytes.to_s) unless fetch_min_bytes.nil?
306
317
  props.put(kafka::GROUP_ID_CONFIG, group_id)
307
318
  props.put(kafka::HEARTBEAT_INTERVAL_MS_CONFIG, heartbeat_interval_ms.to_s) unless heartbeat_interval_ms.nil?
319
+ props.put(kafka::ISOLATION_LEVEL_CONFIG, isolation_level)
308
320
  props.put(kafka::KEY_DESERIALIZER_CLASS_CONFIG, key_deserializer_class)
309
321
  props.put(kafka::MAX_PARTITION_FETCH_BYTES_CONFIG, max_partition_fetch_bytes.to_s) unless max_partition_fetch_bytes.nil?
310
322
  props.put(kafka::MAX_POLL_RECORDS_CONFIG, max_poll_records.to_s) unless max_poll_records.nil?
@@ -79,6 +79,11 @@ class LogStash::Outputs::Kafka < LogStash::Outputs::Base
79
79
  # The compression type for all data generated by the producer.
80
80
  # The default is none (i.e. no compression). Valid values are none, gzip, or snappy.
81
81
  config :compression_type, :validate => ["none", "gzip", "snappy", "lz4"], :default => "none"
82
+ # How DNS lookups should be done. If set to `use_all_dns_ips`, when the lookup returns multiple
83
+ # IP addresses for a hostname, they will all be attempted to connect to before failing the
84
+ # connection. If the value is `resolve_canonical_bootstrap_servers_only` each entry will be
85
+ # resolved and expanded into a list of canonical names.
86
+ config :client_dns_lookup, :validate => ["default", "use_all_dns_ips", "resolve_canonical_bootstrap_servers_only"], :default => "default"
82
87
  # The id string to pass to the server when making requests.
83
88
  # The purpose of this is to be able to track the source of requests beyond just
84
89
  # ip/port by allowing a logical application name to be included with the request
@@ -231,7 +236,7 @@ class LogStash::Outputs::Kafka < LogStash::Outputs::Base
231
236
  remaining = @retries
232
237
 
233
238
  while batch.any?
234
- if !remaining.nil?
239
+ unless remaining.nil?
235
240
  if remaining < 0
236
241
  # TODO(sissel): Offer to DLQ? Then again, if it's a transient fault,
237
242
  # DLQing would make things worse (you dlq data that would be successful
@@ -250,27 +255,39 @@ class LogStash::Outputs::Kafka < LogStash::Outputs::Base
250
255
  begin
251
256
  # send() can throw an exception even before the future is created.
252
257
  @producer.send(record)
253
- rescue org.apache.kafka.common.errors.TimeoutException => e
258
+ rescue org.apache.kafka.common.errors.InterruptException,
259
+ org.apache.kafka.common.errors.RetriableException => e
260
+ logger.info("producer send failed, will retry sending", :exception => e.class, :message => e.message)
254
261
  failures << record
255
262
  nil
256
- rescue org.apache.kafka.common.errors.InterruptException => e
257
- failures << record
258
- nil
259
- rescue org.apache.kafka.common.errors.SerializationException => e
260
- # TODO(sissel): Retrying will fail because the data itself has a problem serializing.
261
- # TODO(sissel): Let's add DLQ here.
262
- failures << record
263
+ rescue org.apache.kafka.common.KafkaException => e
264
+ # This error is not retriable, drop event
265
+ # TODO: add DLQ support
266
+ logger.warn("producer send failed, dropping record",:exception => e.class, :message => e.message,
267
+ :record_value => record.value)
263
268
  nil
264
269
  end
265
- end.compact
270
+ end
266
271
 
267
272
  futures.each_with_index do |future, i|
268
- begin
269
- result = future.get()
270
- rescue => e
271
- # TODO(sissel): Add metric to count failures, possibly by exception type.
272
- logger.warn("producer send failed", :exception => e.class, :message => e.message)
273
- failures << batch[i]
273
+ # We cannot skip nils using `futures.compact` because then our index `i` will not align with `batch`
274
+ unless future.nil?
275
+ begin
276
+ future.get
277
+ rescue java.util.concurrent.ExecutionException => e
278
+ # TODO(sissel): Add metric to count failures, possibly by exception type.
279
+ if e.get_cause.is_a? org.apache.kafka.common.errors.RetriableException or
280
+ e.get_cause.is_a? org.apache.kafka.common.errors.InterruptException
281
+ logger.info("producer send failed, will retry sending", :exception => e.cause.class,
282
+ :message => e.cause.message)
283
+ failures << batch[i]
284
+ elsif e.get_cause.is_a? org.apache.kafka.common.KafkaException
285
+ # This error is not retriable, drop event
286
+ # TODO: add DLQ support
287
+ logger.warn("producer send failed, dropping record", :exception => e.cause.class,
288
+ :message => e.cause.message, :record_value => batch[i].value)
289
+ end
290
+ end
274
291
  end
275
292
  end
276
293
 
@@ -318,6 +335,7 @@ class LogStash::Outputs::Kafka < LogStash::Outputs::Base
318
335
  props.put(kafka::BOOTSTRAP_SERVERS_CONFIG, bootstrap_servers)
319
336
  props.put(kafka::BUFFER_MEMORY_CONFIG, buffer_memory.to_s)
320
337
  props.put(kafka::COMPRESSION_TYPE_CONFIG, compression_type)
338
+ props.put(kafka::CLIENT_DNS_LOOKUP_CONFIG, client_dns_lookup)
321
339
  props.put(kafka::CLIENT_ID_CONFIG, client_id) unless client_id.nil?
322
340
  props.put(kafka::KEY_SERIALIZER_CLASS_CONFIG, key_serializer)
323
341
  props.put(kafka::LINGER_MS_CONFIG, linger_ms.to_s)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-integration-kafka'
3
- s.version = '10.2.0'
3
+ s.version = '10.5.2'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Integration with Kafka - input and output plugins"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline "+
@@ -56,14 +56,15 @@ describe "outputs/kafka" do
56
56
  end
57
57
  end
58
58
 
59
- context "when KafkaProducer#send() raises an exception" do
59
+ context "when KafkaProducer#send() raises a retriable exception" do
60
60
  let(:failcount) { (rand * 10).to_i }
61
61
  let(:sendcount) { failcount + 1 }
62
62
 
63
63
  let(:exception_classes) { [
64
64
  org.apache.kafka.common.errors.TimeoutException,
65
+ org.apache.kafka.common.errors.DisconnectException,
66
+ org.apache.kafka.common.errors.CoordinatorNotAvailableException,
65
67
  org.apache.kafka.common.errors.InterruptException,
66
- org.apache.kafka.common.errors.SerializationException
67
68
  ] }
68
69
 
69
70
  before do
@@ -88,6 +89,37 @@ describe "outputs/kafka" do
88
89
  end
89
90
  end
90
91
 
92
+ context "when KafkaProducer#send() raises a non-retriable exception" do
93
+ let(:failcount) { (rand * 10).to_i }
94
+
95
+ let(:exception_classes) { [
96
+ org.apache.kafka.common.errors.SerializationException,
97
+ org.apache.kafka.common.errors.RecordTooLargeException,
98
+ org.apache.kafka.common.errors.InvalidTopicException
99
+ ] }
100
+
101
+ before do
102
+ count = 0
103
+ expect_any_instance_of(org.apache.kafka.clients.producer.KafkaProducer).to receive(:send)
104
+ .exactly(1).times
105
+ .and_wrap_original do |m, *args|
106
+ if count < failcount # fail 'failcount' times in a row.
107
+ count += 1
108
+ # Pick an exception at random
109
+ raise exception_classes.shuffle.first.new("injected exception for testing")
110
+ else
111
+ m.call(*args) # call original
112
+ end
113
+ end
114
+ end
115
+
116
+ it "should not retry" do
117
+ kafka = LogStash::Outputs::Kafka.new(simple_kafka_config)
118
+ kafka.register
119
+ kafka.multi_receive([event])
120
+ end
121
+ end
122
+
91
123
  context "when a send fails" do
92
124
  context "and the default retries behavior is used" do
93
125
  # Fail this many times and then finally succeed.
@@ -107,7 +139,7 @@ describe "outputs/kafka" do
107
139
  # inject some failures.
108
140
 
109
141
  # Return a custom Future that will raise an exception to simulate a Kafka send() problem.
110
- future = java.util.concurrent.FutureTask.new { raise "Failed" }
142
+ future = java.util.concurrent.FutureTask.new { raise org.apache.kafka.common.errors.TimeoutException.new("Failed") }
111
143
  future.run
112
144
  future
113
145
  else
@@ -129,7 +161,7 @@ describe "outputs/kafka" do
129
161
  .once
130
162
  .and_wrap_original do |m, *args|
131
163
  # Always fail.
132
- future = java.util.concurrent.FutureTask.new { raise "Failed" }
164
+ future = java.util.concurrent.FutureTask.new { raise org.apache.kafka.common.errors.TimeoutException.new("Failed") }
133
165
  future.run
134
166
  future
135
167
  end
@@ -143,7 +175,7 @@ describe "outputs/kafka" do
143
175
  .once
144
176
  .and_wrap_original do |m, *args|
145
177
  # Always fail.
146
- future = java.util.concurrent.FutureTask.new { raise "Failed" }
178
+ future = java.util.concurrent.FutureTask.new { raise org.apache.kafka.common.errors.TimeoutException.new("Failed") }
147
179
  future.run
148
180
  future
149
181
  end
@@ -164,7 +196,7 @@ describe "outputs/kafka" do
164
196
  .at_most(max_sends).times
165
197
  .and_wrap_original do |m, *args|
166
198
  # Always fail.
167
- future = java.util.concurrent.FutureTask.new { raise "Failed" }
199
+ future = java.util.concurrent.FutureTask.new { raise org.apache.kafka.common.errors.TimeoutException.new("Failed") }
168
200
  future.run
169
201
  future
170
202
  end
@@ -175,10 +207,10 @@ describe "outputs/kafka" do
175
207
 
176
208
  it 'should only sleep retries number of times' do
177
209
  expect_any_instance_of(org.apache.kafka.clients.producer.KafkaProducer).to receive(:send)
178
- .at_most(max_sends)
210
+ .at_most(max_sends).times
179
211
  .and_wrap_original do |m, *args|
180
212
  # Always fail.
181
- future = java.util.concurrent.FutureTask.new { raise "Failed" }
213
+ future = java.util.concurrent.FutureTask.new { raise org.apache.kafka.common.errors.TimeoutException.new("Failed") }
182
214
  future.run
183
215
  future
184
216
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.2.0
4
+ version: 10.5.2
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-30 00:00:00.000000000 Z
11
+ date: 2020-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement