-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[filebeat] Add a Kafka input #12850
Merged
Merged
[filebeat] Add a Kafka input #12850
Changes from 48 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
c0dbd6a
Add kafka input to filebeat import list
faec 878a9e7
Initial skeleton of filebeat kafka input
faec 5f6c0d9
Cleanup
faec 1c83d55
Turn on Wait() and Stop()
faec 7298e9c
add InitialOffset configuration parameter
faec 7345c18
Document new kafka output fields
faec b925014
Add username / password and ssl config
faec 1f6ecc3
Add parameter for client id
faec 207bebe
Add metric registry to sarama reader
faec ec386a0
Log kafka errors
faec 0aaa710
Add remaining kafka metadata fields
faec 95e6bff
document new metadata fields
faec 5bb711c
Adjust kafka producer version / test message in tests
faec 9601e0c
Don't record BlockTimestamp if it's zero
faec 2d8d37c
Remove debug printf
faec e6b8b53
make fmt
faec a843dbc
Merge branch 'master' into kafka-input
faec 426c98f
Add kafka container to filebeat integration tests
faec 43f1cde
regenerate docs
faec da3eb99
Remove unused test helpers
faec 3da5f99
Add header verification to kafka integration test
faec 6bdb13f
Addressing review comments
faec bfeaeb0
Review comments
faec 8061d86
Add several more kafka configuration settings
faec 678d71b
Document kafka input configuration
faec b8b3446
Merge branch 'master' into kafka-input
faec 6a45e05
Update for new outlet api
faec 5cee082
Add end-to-end ACK to the kafka input / synchronize access to the ses…
faec a16e862
Update integration test
faec e2137cb
make integration test an integration test againk not unit
faec cd8a3d9
Replace sarama context with a minimal wrapper suggested by @urso
faec e54b9d8
Clarify docs
faec 418364a
Addressing review comments
faec 73aa0bc
Fix kafka input Stop()
faec 76f7792
revised run loop in progress
faec 1a29d7b
refactor groupHandler / fix end-to-end ACK
faec c903177
Use strings for kafka headers
faec f5dd360
Make kafka message keys strings on indexing
faec 4e73ac8
Adjust config parameter names
faec f2441d8
Update changed config fields in docs
faec 6aa839e
Merge branch 'master' into kafka-input
faec 6ad363e
Add IsolationLevel config option
faec df98c90
Document IsolationLevel
faec a90d7c5
working on corrected index template
faec c302125
add compromise data layout for kafka headers
faec 6ae3210
addressing review comments
faec 43b5bec
use exponential backoff for connecting
faec 62488ef
shutdown outlet via the CloseRef config field
faec 60f436c
Fixing backoff wait call
faec e223a64
Add wait_close parameter
faec 135da31
Update header handling in integration test
faec 5f64da9
Fix backoff handling again...
faec 419ddab
Adjust what the connection backoff responds to
faec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
:type: kafka | ||
|
||
[id="{beatname_lc}-input-{type}"] | ||
=== Kafka input | ||
|
||
++++ | ||
<titleabbrev>Kafka</titleabbrev> | ||
++++ | ||
|
||
Use the `kafka` input to read from topics in a Kafka cluster. | ||
|
||
To configure this input, specify a list of one or more <<hosts,`hosts`>> in the | ||
cluster to bootstrap the connection with, a list of <<topics,`topics`>> to | ||
track, and a <<groupid,`group_id`>> for the connection. | ||
|
||
Example configuration: | ||
|
||
["source","yaml",subs="attributes"] | ||
---- | ||
{beatname_lc}.inputs: | ||
- type: kafka | ||
hosts: | ||
- kafka-broker-1:9092 | ||
- kafka-broker-2:9092 | ||
topics: ["my-topic"] | ||
group_id: "filebeat" | ||
|
||
---- | ||
|
||
|
||
[id="{beatname_lc}-input-{type}-options"] | ||
==== Configuration options | ||
|
||
The `kafka` input supports the following configuration options plus the | ||
<<{beatname_lc}-input-{type}-common-options>> described later. | ||
|
||
[float] | ||
[[hosts]] | ||
===== `hosts` | ||
|
||
A list of Kafka bootstrapping hosts (brokers) for this cluster. | ||
|
||
[float] | ||
[[topics]] | ||
===== `topics` | ||
|
||
A list of topics to read from. | ||
|
||
[float] | ||
[[groupid]] | ||
===== `group_id` | ||
|
||
The Kafka consumer group id. | ||
|
||
[float] | ||
===== `client_id` | ||
|
||
The Kafka client id (optional). | ||
|
||
[float] | ||
===== `version` | ||
|
||
The version of the Kafka protocol to use (defaults to `"1.0.0"`). | ||
|
||
[float] | ||
===== `initial_offset` | ||
|
||
The initial offset to start reading, either "oldest" or "newest". Defaults to | ||
"oldest". | ||
|
||
===== `connect_backoff` | ||
|
||
How long to wait before trying to reconnect to the kafka cluster after a | ||
fatal error. Default is 30s. | ||
|
||
===== `consume_backoff` | ||
|
||
How long to wait before retrying a failed read. Default is 2s. | ||
|
||
===== `max_wait_time` | ||
|
||
How long to wait for the minimum number of input bytes while reading. Default | ||
is 250ms. | ||
|
||
===== `isolation_level` | ||
|
||
This configures the Kafka group isolation level: | ||
|
||
- `"read_uncommitted"` returns _all_ messages in the message channel. | ||
- `"read_committed"` hides messages that are part of an aborted transaction. | ||
|
||
The default is `"read_uncommitted"`. | ||
|
||
===== `fetch` | ||
|
||
Kafka fetch settings: | ||
|
||
*`min`*:: The minimum number of bytes to wait for. Defaults to 1. | ||
|
||
*`default`*:: The default number of bytes to read per request. Defaults to 1MB. | ||
|
||
*`max`*:: The maximum number of bytes to read per request. Defaults to 0 | ||
(no limit). | ||
|
||
===== `rebalance` | ||
|
||
Kafka rebalance settings: | ||
|
||
*`strategy`*:: Either `"range"` or `"roundrobin"`. Defaults to `"range"`. | ||
|
||
*`timeout`*:: How long to wait for an attempted rebalance. Defaults to 60s. | ||
|
||
*`max_retries`*:: How many times to retry if rebalancing fails. Defaults to 4. | ||
|
||
*`retry_backoff`*:: How long to wait after an unsuccessful rebalance attempt. | ||
Defaults to 2s. | ||
|
||
[id="{beatname_lc}-input-{type}-common-options"] | ||
include::../inputs/input-common-options.asciidoc[] | ||
|
||
:type!: |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@faec @urso I wonder if we should use the same fields metricbeat uses for this, in case we want to correlate and/or monitor the kafka topics used. Metricbeat uses
kafka.topic.name
for the topic andkafka.partition.id
for the partition.And I wonder if message specific fields (
offset
,key
,headers
) should be under an specific namespace askafka.message
, at least to differentiate the offset from other offsets.