# Docker hints based autodiscover custom label

**URL:** https://discuss.elastic.co/t/docker-hints-based-autodiscover-custom-label/200999
**Category:** Beats
**Tags:** filebeat
**Created:** [September 25, 2019, 9:10am UTC](https://discuss.elastic.co/t/docker-hints-based-autodiscover-custom-label/200999 "2019-09-25T09:10:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jbws](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jbws](https://discuss.elastic.co/u/jbws)
#### Post date: [September 25, 2019, 9:10am UTC](https://discuss.elastic.co/t/docker-hints-based-autodiscover-custom-label/200999/1 "2019-09-25T09:10:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jbws](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jbws](https://discuss.elastic.co/u/jbws)
#### Post date: [September 25, 2019, 1:12pm UTC](https://discuss.elastic.co/t/docker-hints-based-autodiscover-custom-label/200999/2 "2019-09-25T13:12:37Z")

</div>

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"

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 23, 2019, 1:12pm UTC](https://discuss.elastic.co/t/docker-hints-based-autodiscover-custom-label/200999/3 "2019-10-23T13:12:47Z")

</div>

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