I'm using Filebeats to capture and send my Docker container logs to Elasticsearch. I am adding the Docker metadata and I would like to name each index with the associated service name. Based on the default template, I was looking at the docker.container.labels.com.docker.swarm.service.name field for my index name. I tried setting this in the filebeat.yml file but although the container started successfully, no indices were created in elasticsearch.
The relevant port of the filebeats.yml file look like this-
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
filebeat.modules:
- module: logstash
filebeat.inputs:
- type: docker
combine_partial: true
containers:
path: "/var/lib/docker/containers"
stream: "all"
ids:
- "*"
processors:
- add_docker_metadata: ~
output.elasticsearch:
hosts: ["http://elasticsearch_log:9200"]
index: "%{[docker.container.labels.com.docker.swarm.service.name]}-%{[beat.version]}-%{+yyyy.MM.dd}"
setup.template:
name: "%{[docker.container.labels.com.docker.swarm.service.name]}"
pattern: "%{[docker.container.labels.com.docker.swarm.service.name]}-*"
setup.kibana:
host: ["kibana:5601"]
I recognize this will result in a lot indices but I am not concerned with that right now, just seeing if this is a workable configuration.
Please advise.
Thanks.