Filebeat: Variables in Output Hosts Doesn't Work

Is there a way to include variables in output hosts? For example

filebeat.yml

filebeat:
  config_dir: "/var/filebeat/conf.d"

output.kafka:
  hosts: "%{[fields.mybrokers]}"
  topic: "%{[fields.mytopic]}"

conf.d/myconfig.yml

filebeat.prospectors:
- input_type: log

  paths:
    - /var/log/*

  fields:
    service: some_service
    mytopic: mytopic1
    mybrokers: ["host1", "host2"]

Doing this yields this erros: WARN kafka message: client/metadata got error from broker while fetching metadata:%!(EXTRA *net.OpError=dial tcp: missing port in address %{[fields.mybrokers]})

Thanks!Preformatted text

You cannot control hosts or files (in the case of the file output) via variables. Doing so would require Beats to manage state and connections to each different host. You can only use variables to control the destination topic, but not the broker.

Thanks for the reply!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.