Filebeat will sends this output from a RedHat system that runs docker version 19.03.1:
"container": {
"id": "containers"
},
so the container metadata doesn't have the appropriate docker id, name, image name and labels information's as shown in the example below from system that runs docker version 18.06.3 with the appropriate filebeat input config:
I use logging.level=error but don't see any error related to this.
However when I enable the DEBUG level I see the following messages:
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.910+0200 DEBUG [docker] docker/client.go:48 Docker client will negotiate the API version on the first request.
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.942+0200 DEBUG [add_docker_metadata] add_docker_metadata/add_docker_metadata.go:91 add_docker_metadata: docker environment detected
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.942+0200 DEBUG [docker] docker/watcher.go:198 Start docker containers scanner
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.942+0200 DEBUG [docker] docker/watcher.go:333 List containers
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.946+0200 DEBUG [bus] bus/bus.go:83 docker: map[container:0xc000554000 start:true]
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.946+0200 DEBUG [docker] docker/watcher.go:246 Fetching events since 1589812692
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.946+0200 DEBUG [bus] bus/bus.go:83 docker: map[container:0xc000554070 start:true]
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.946+0200 DEBUG [processors] processors/processor.go:101 Generated new processors: add_host_metadata=[netinfo.enabled=[false], cache.ttl=[5m0s]], add_docker_metadata=[match_fields=[] match_pids=[process.pid, process.ppid]]
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.946+0200 DEBUG [bus] bus/bus.go:83 docker: map[container:0xc0005540e0 start:true]
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.946+0200 DEBUG [bus] bus/bus.go:83 docker: map[container:0xc000554150 start:true]
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.946+0200 DEBUG [bus] bus/bus.go:83 docker: map[container:0xc0005541c0 start:true]
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.946+0200 DEBUG [bus] bus/bus.go:83 docker: map[container:0xc000554230 start:true]
So filebeat detects the log files of running containers. However when the file start to harvest you get that the cid is not found during the add_docker_metadata processing.. the log looks as follow:
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.953+0200 DEBUG [input] log/input.go:421 Check file for harvesting: /data/var/lib/docker/containers/8ecd6d7e294e5a5d868c176a6ca1f189c0c35450330cbfbfbab8171200c0554a/8ecd6d7e294e5a5d868c176a6ca1f189c0c35450330cbfbfbab8171200c0554a-json.log
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.953+0200 DEBUG [input] log/input.go:494 Start harvester for new file: /data/var/lib/docker/containers/8ecd6d7e294e5a5d868c176a6ca1f189c0c35450330cbfbfbab8171200c0554a/8ecd6d7e294e5a5d868c176a6ca1f189c0c35450330cbfbfbab8171200c0554a-json.log
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.953+0200 DEBUG [add_docker_metadata] add_docker_metadata/add_docker_metadata.go:207 Container not found: cid=containers
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.954+0200 DEBUG [processors] processing/processors.go:186 Publish event: {
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.954+0200 DEBUG [harvester] log/harvester.go:501 Setting offset for file based on seek: /data/var/lib/docker/containers/8ecd6d7e294e5a5d868c176a6ca1f189c0c35450330cbfbfbab8171200c0554a/8ecd6d7e294e5a5d868c176a6ca1f189c0c35450330cbfbfbab8171200c0554a-json.log
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.954+0200 DEBUG [add_docker_metadata] add_docker_metadata/add_docker_metadata.go:207 Container not found: cid=containers
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.954+0200 DEBUG [harvester] log/harvester.go:487 Setting offset for file: /data/var/lib/docker/containers/8ecd6d7e294e5a5d868c176a6ca1f189c0c35450330cbfbfbab8171200c0554a/8ecd6d7e294e5a5d868c176a6ca1f189c0c35450330cbfbfbab8171200c0554a-json.log. Offset: 0
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.954+0200 DEBUG [harvester] log/harvester.go:182 Harvester setup successful. Line terminator: 1
May 18 16:38:12 [hostname] filebeat[45566]: 2020-05-18T16:38:12.954+0200 DEBUG [processors] processing/processors.go:186 Publish event: {
... etc
Looks like that cid filed is not fill with the proper docker container id?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.