Docker hints based autodiscover custom label

Can I create a custom label in my container and then choose an index based on that?
For example co.elastic.logs/environment=staging
I have test and staging applications running in the same cluster that need to log to different indices.

Resolved myself.

For anyone else wanting to know...

Create a label on the container. I used co.elastic.logs/index

In the filebeat config choose index based on the label.

output.elasticsearch:
indices:
- index: "indexname-%{+yyyy.MM.dd}"
when.equals:
docker.container.labels.co_elastic_logs/index: "indexname"

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