可以实现,通过topics
,以下是一个例子:
output.kafka:
hosts: ["localhost:9092"]
topic: "logs-%{[agent.version]}"
topics:
- topic: "critical-%{[agent.version]}"
when.contains:
message: "CRITICAL"
- topic: "error-%{[agent.version]}"
when.contains:
message: "ERR"
参考来自官方文章:https://www.elastic.co/guide/en/beats/filebeat/master/kafka-output.html#topics-option-kafka