Fix docs on how dynamic topic can be set on kafka#5403
Fix docs on how dynamic topic can be set on kafka#5403khushijain21 wants to merge 6 commits intoelastic:mainfrom
Conversation
✅ Vale Linting ResultsNo issues found on modified lines! The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
🔍 Preview links for changed docs |
|
Hi @khushijain21, the file you are modifying is for setting up the Kafka output in a standalone Elastic Agent’s configuration. There is also another file which is for setting up the Kafka output in the Fleet UI ( Some time ago, I updated both files in #3048 and #3356 to add information about setting dynamic topic values. At the time, I remember getting to the conclusion that there are small difference between how the Beats configurations and Elastic Agent configurations are handling dynamic values (see Variables and conditions in input configurations), hence the difference in the docs for the Kafka output configuration for Filebeat and for the standalone Elastic Agent. Beats configuration example: topic: '%{[fields.log_topic]}'
fields:
log_topic: '%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}'Elastic Agent configuration example: topic: '${fields.kafka_topic}'
fields:
kafka_topic: '${data_stream.type}-${data_stream.dataset}-${data_stream.namespace}'(A different custom field name is used for the example in the Elastic Agent docs.) I might be wrong and maybe this was a mistake on my side, but I’d like to get some clarification first. @cmacknz is this something you can help with? Thank you! |
|
${var} represents variable substituiton where var is the name of a variable defined by a provider. But %{} is different - this is used to dynamically set value based on the event.
When this config is used applying new policy: generating component model: rendering outputs failed: rendering output \"kafka-output\" failed: no matching vars: ${data_stream.type}What I would have expected it is that events are correctly routed based on data stream type |
|
Hmm, I see… would that also be the case if the same syntax is used in the Fleet UI for a Fleet-managed agent, do you know? If yes, then we’ll also have to update the |
|
Yes I think this would be same syntax. See PR elastic/beats#40415 where similar syntax in fleet is used. Ill update the docs |
| **Broker timeout** $$$kafka-output-broker-timeout$$$ | ||
| : The maximum length of time a Kafka broker waits for the required number of ACKs before timing out (see the `ACK reliability` setting further in). The default is 30 seconds. | ||
|
|
||
| **Broker reachability timeout** $$$kafka-output-broker-reachability-timeout$$$ | ||
| : The maximum length of time that an {{agent}} waits for a response from a Kafka broker before timing out. The default is 30 seconds. |
There was a problem hiding this comment.
If the default is 10s (as your update for the standalone configuration suggests), maybe lines 194 (and maybe 197?) should also be updated?
| ## Partition settings [output-kafka-partition-settings] | ||
|
|
||
| The number of partitions created is set automatically by the Kafka broker based on the list of topics. Records are then published to partitions either randomly, in round-robin order, or according to a calculated hash. | ||
| The number of partitions created is set automatically by the Kafka broker based on the list of topics. Records are then published to partitions either randomly, in round-robin order, or according to a calculated hash. Default is hash partitioner |
There was a problem hiding this comment.
| The number of partitions created is set automatically by the Kafka broker based on the list of topics. Records are then published to partitions either randomly, in round-robin order, or according to a calculated hash. Default is hash partitioner | |
| The number of partitions created is set automatically by the Kafka broker based on the list of topics. Records are then published to partitions either randomly, in round-robin order, or according to a calculated hash. The default is hash partitioner. |
Summary
The docs were incorrect on how to set dynamic topic in kafka . See filebeat-kafka-output for correct example on how topic should be set. Updated the same here.