Filebeat failed to collect docker metadata

I use filebeat to collect docker container logs. The log is collected by ID, but the corresponding container name cannot be collected. So I tried to add metadata for the docker container, but I couldn't succeed(Auto discovery can also collect docker logs, but it can't use multiple configurations like input)

The current configuration is as follows:

filebeat.config.inputs:
  enabled: true
  path: /root/filebeat/*.yml
  reload.enabled: true
  reload.period: 60s
  processors:
  - add_docker_metadata:
    host: "unix:///var/run/docker.sock"
    #match_source: true

output.logstash:
  hosts: ["192.168.1.251:5044"]
max_procs: 1
queue.mem:
  events: 256
  flush.min_events: 128
  flush.timeout: 5s

logging.level: info
logging.to_files: true
logging.files:
  path: /var/log/filebeat
  name: filebeat.log
  keepfiles: 3
  permissions: 0644

Specific business log:

- type: docker
  containers.ids:
    - '2e2b4073b0c751732634682a03ecd6e1433fe1f2c7703ce1235ff3b6a071147e'
    - '27cdc8fdecfd58c0f8bcd2971964bcea72f6f2dd600443972bde55b34e24fb1b'
    - '341c6baf93754cf8c6083a159f1bf0b690c9512f2d0c125a65e709ab59693bea'
  tags: ["mysql_console_pre"]
  fields:
    service: mysql_console
  fields_under_root: true
  tail_files: false

I can collect docker logs, but I can't get the corresponding metadata。

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