I use filebeat to collect docker logs and add a label when the docker container starts.
![]()
- type: docker
enabled: true
containers.ids:
- '*'
tail_files: true
The following configuration is made in logstash to build a dynamic index.
filter {
json {
source => "message"
}
}
output {
elasticsearch {
hosts => ["192.168.6.155:9200","192.168.6.156:9200","192.168.6.157:9200"]
ssl => true
cacert => "/etc/logstash/ssl/root.pem"
index => "%{[container.labels.service]}-%{+YYYY.MM.dd}"
}
}
But I failed and got the following index
