Hi everyone, before opening an issue on Github, I will try here. As subject states, Filebeat Autodiscover appenders are not working as expected - configuration is not being applied. If I configure add_docker_metadata
as label on service, Docker Labels are being applied, using autodiscover plugin config hints.
I am running ELK stack on Mac, using Docker Desktop for Mac.
Filebeat version is 7.9.1.
Anyhow, here goes my minimal filebeat.yml config:
filebeat.config:
modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
filebeat.autodiscover:
providers:
- type: docker
hints.enabled: true
hints.default_config:
type: container
paths:
- '/var/lib/docker/containers/${data.container.id}/*.log'
combine_partial: false
fields_under_root: true
exclude_files: [".gz$", "_[0-9]{4}-[0-9]{2}-[0-9]{2}"]
tail_files: false
ignore_older: 24h
close_inactive: 1h
appenders:
- type: config
merge: append
config:
- add_docker_metadata:
labels.dedot: false
output.elasticsearch:
hosts: 'http://es01:9200'
pipeline: "filebeat-7.9.1-pipeline"
For testing purpose, I am using a docker-compose
to spin up another service:
version: '3.2'
services:
docker-logs:
user: root
image: docker-logs:latest
container_name: docker-logs
labels:
# co.elastic.logs/processors.add_docker_metadata.labels.dedot: "false"
co.elastic.logs/processors.add_fields.fields.name: "MY_FIELDS"
co.elastic.logs/processors.add_fields.fields.id: "MY_VAULE"
However, the Docker labels are only being applied, if I configure the add_docker_metadata
on service above, where desired would be to apply the add_docker_metadata
processor in autodiscover
context of filebeat.yml configuration file.
From Filebeat logs there is only one line being logged, relevant to appenders:
filebeat | 2020-10-19T17:18:53.562Z INFO cfgfile/reload.go:224 Loading of config files completed.
filebeat | 2020-10-19T17:18:53.577Z WARN [cfgwarn] config/config.go:50 BETA: The config appender is beta
filebeat | 2020-10-19T17:18:53.583Z INFO [autodiscover] autodiscover/autodiscover.go:113 Starting autodiscover manager
EDITS: Mostly code formatting.