-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Description
Kibana version: 8.17.0 and 8.16.1
Elasticsearch version: 8.17.0 and 8.16.1
Server OS version: macOS Sequoia Version 15.2
Browser version: 131.0.6778.205
Browser OS version: macOS Sequoia Version 15.2
Original install method (e.g. download page, yum, from source, etc.):
docker installation of elasticsearch, kibana, fleet-agent, elastic-agent, kafka, zookeeper
Describe the bug:
Kibana introduces a leading '%{[
' and trailing ']}
' pattern to the custom topic name, which results in a "error":{"message":"failed to reload output: format string variables can not be nested in kafka.topic"} in the elastic-agent
Steps to reproduce:
In the Fleet > Settings > Add Output, choose Kafka and try the following options
-
Choose "Dynamic Topic" and key-in a custom topic name in the "Text Field" option say for example:
%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}
, as in the image belowIn the Kibana logs you will see that new fleet output got added but the topic name is appended with these pattern "topics":[{"topic":"
%{[
%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}]}
"}]Kibana Log
[2024-12-20T07:07:59.608+00:00][DEBUG][elasticsearch.query.data] 201 - 210.0B
PUT /.kibana_ingest_8.16.1/_create/ingest-outputs%3A57bb95ca-00e5-446e-a8b2-4f3df1b6a2fd?refresh=wait_for&require_alias=true
{"ingest-outputs":{"name":"kafka","type":"kafka","hosts":["kafka:9093"],"is_default":false,"is_default_monitoring":false,"config_yaml":"","proxy_id":null,"client_id":"Elastic","version":"2.6.0","compression":"none","auth_type":"none","connection_type":"plaintext","partition":"random","random":{"group_events":1},"topics":[{"topic":"%{[%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}]}"}]
,"headers":[{"key":"","value":""}],"timeout":30,"broker_timeout":30,"required_acks":1},"type":"ingest-outputs","references":[],"managed":false,"coreMigrationVersion":"8.8.0","typeMigrationVersion":"10.6.0","updated_at":"2024-12-20T07:07:58.596Z","created_at":"2024-12-20T07:07:58.596Z"}
[2024-12-20T07:07:59.609+00:00][DEBUG][plugins.fleet] Created new outputWhen you assign this kafka output as the default output for Elastic Agent, it would fail with the following error
Elastic Agent : Error Log : failed to reload output: format string variables can not be nested in kafka.topic
{"log.level":"error","@timestamp":"2024-12-20T07:08:39.963Z","message":"could not start output","component":{"binary":"filebeat","dataset":"elastic_agent.filebeat","id":"log-57bb95ca-00e5-446e-a8b2-4f3df1b6a2fd","type":"log"},"log":{"source":"log-57bb95ca-00e5-446e-a8b2-4f3df1b6a2fd"},"log.origin":{"file.line":662,"file.name":"management/managerV2.go","function":"github.com/elastic/beats/v7/x-pack/libbeat/management.(*BeatV2Manager).reload"},"service.name":"filebeat",
"error":{"message":"failed to reload output: format string variables can not be nested in kafka.topic"}
,"ecs.version":"1.6.0","log.logger":"centralmgmt.V2-manager","ecs.version":"1.6.0"} -
Choose "Dynamic Topic" and key-in a custom topic name in the "Text Field" option say for example:
data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace
, as in the image below
Note: We intentionally removed the leading '%{[
' and trailing ']}
' while keying-in the custom-topicKibana again wraps the custom-topic with the leading and trailing pattern, but then this time since we intentionally removed it from the topic name, when kibana wraps it becomes a proper topic name.
Kibana Log
PUT /.kibana_ingest_8.16.1/_create/ingest-outputs%3Aac3be3a0-17b9-4907-b0d9-77163ce0befa?refresh=wait_for&require_alias=true
{"ingest-outputs":{"name":"kafka","type":"kafka","hosts":["kafka:9093"],"is_default":false,"is_default_monitoring":false,"config_yaml":"","proxy_id":null,"client_id":"Elastic","version":"2.6.0","compression":"none","auth_type":"none","connection_type":"plaintext","partition":"random","random":{"group_events":1},"topics":[{"topic":"%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}"}]
,"headers":[{"key":"","value":""}],"timeout":30,"broker_timeout":30,"required_acks":1},"type":"ingest-outputs","references":[],"managed":false,"coreMigrationVersion":"8.8.0","typeMigrationVersion":"10.6.0","updated_at":"2024-12-20T15:15:42.215Z","created_at":"2024-12-20T15:15:42.215Z"}
[2024-12-20T15:15:42.350+00:00][DEBUG][plugins.fleet] Created new output ac3be3a0-17b9-4907-b0d9-77163ce0befaElastic Agent Log
No Errors in Elastic-Agent and we will see the custom topics being created in Kafka and the Data flows into those Custom Kafka topics.
Expected behavior:
Kibana should not wrap the custom-topic name with a leading '%{[
' and trailing ']}
' pattern
Errors in browser console (if relevant):
There are no errors in browser console, but the Elastic Agent fails to transport data to Kafka as discussed above