-
Notifications
You must be signed in to change notification settings - Fork 152
Update the topic description of the Kafka output docs to fix some errors #3356
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
Open
vishaangelova
wants to merge
2
commits into
main
Choose a base branch
from
fix-kafka-output-doc-fleet
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+25
−15
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -164,25 +164,35 @@ Use these options to set the Kafka topic for each {{agent}} event. | |
`topic` $$$kafka-topic-setting$$$ | ||
: The default Kafka topic used for produced events. | ||
|
||
You can set a static topic, for example `elastic-agent`, or you can choose to set a topic dynamically based on an [Elastic Common Schema (ECS)](ecs://reference/index.md) field. Available fields include: | ||
You can set a static topic, for example `elastic-agent`, or you can use a format string to set a topic dynamically based on an [Elastic Common Schema (ECS)](ecs://reference/index.md) field. Available fields include: | ||
|
||
* `data_stream.type` | ||
* `data_stream.dataset` | ||
* `data_stream.namespace` | ||
* `@timestamp` | ||
* `event-dataset` | ||
* `event.dataset` | ||
|
||
For example: | ||
|
||
```yaml | ||
topic: '${data_stream.type}' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the Kafka output doc under “Configure standalone Elastic Agents”. I assume the topic settings need to be added in the |
||
``` | ||
|
||
You can also set a custom field. This is useful if you need to construct a more complex or structured topic name. | ||
You can also set a custom field. This is useful if you need to construct a more complex or structured topic name. For example, this configuration uses the `fields.kafka_topic` custom field to set the topic for each event: | ||
|
||
```yaml | ||
topic: '${fields.kafka_topic}' | ||
``` | ||
|
||
To set a dynamic topic value for outputting {{agent}} data to Kafka, you can add the [`add_fields` processor](/reference/fleet/add_fields-processor.md) to the input configuration settings of your standalone {{agent}}. | ||
To set a dynamic topic value for outputting {{agent}} data to Kafka, you can add the [`add_fields` processor](/reference/fleet/add_fields-processor.md) to the input configuration settings of your standalone {{agent}}. | ||
|
||
For example, the following `add_fields` processor creates a dynamic topic value by interpolating multiple [data stream fields](ecs://reference/ecs-data_stream.md): | ||
For example, the following `add_fields` processor creates a dynamic topic value for the `fields.kafka_topic` field by interpolating multiple [data stream fields](ecs://reference/ecs-data_stream.md): | ||
|
||
```yaml | ||
- add_fields: | ||
target: '' | ||
fields: | ||
kafka_topic: '${data_stream.type}-${data_stream.dataset}-${data_stream.namespace}' <1> | ||
target: '' | ||
fields: | ||
kafka_topic: '${data_stream.type}-${data_stream.dataset}-${data_stream.namespace}' <1> | ||
``` | ||
1. Depending on the values of the data stream fields, this generates topic names such as `logs-nginx.access-production` or `metrics-system.cpu-staging` as the value of the custom `kafka_topic` field. | ||
|
||
|
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is the Kafka output doc under “Manage Elastic Agents in Fleet”. The description here needs to match what the user enters in the field on the UI, under Kafka output > Topics > Default topic > Dynamic Topic > Topic from field(s)
I wasn’t sure whether the user needs to wrap the custom field in
${}
or%{[]}
on the UI, but seeing that the dropdown list contained the ECS fields without these characters, I used the plainfields.kafka_topic
here. Is that a correct assumption?