# Is there support for selecting containers other than by container id?

**URL:** <https://discuss.elastic.co/t/is-there-support-for-selecting-containers-other-than-by-container-id/168125>\
**Category:** Beats\
**Tags:** docker, filebeat\
**Created:** [February 12, 2019, 11:43pm UTC](https://discuss.elastic.co/t/is-there-support-for-selecting-containers-other-than-by-container-id/168125 "2019-02-12T23:43:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![username1234](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/username1234/32/69446_2.png) [@username1234](https://discuss.elastic.co/u/username1234)\
**Post date:** [February 12, 2019, 11:43pm UTC](https://discuss.elastic.co/t/is-there-support-for-selecting-containers-other-than-by-container-id/168125/1 "2019-02-12T23:43:42Z")

</div>

I want to apply a prospector to only some of the docker containers I am running. However, it appears that the only way to select the containers in the prospector yml config is to specify container.ids which only matches on the container id. What would be really helpful is to match on either container name or a label on the docker image. Is there any way to do this currently? If not, is there any planned support for this?

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [February 13, 2019, 5:38pm UTC](https://discuss.elastic.co/t/is-there-support-for-selecting-containers-other-than-by-container-id/168125/2 "2019-02-13T17:38:01Z")

</div>

Yes, it's possible to specify matching conditions for fields other than container IDs. This doc gives you an idea of how to do that: [https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover.html](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover.html).

---

<div class="post-metadata">

**Author:** ![Tiago\_Silva1](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tiago\_Silva1](https://discuss.elastic.co/u/Tiago_Silva1)\
**Post date:** [March 7, 2019, 5:43pm UTC](https://discuss.elastic.co/t/is-there-support-for-selecting-containers-other-than-by-container-id/168125/3 "2019-03-07T17:43:27Z")

</div>

Hello Shaunak,  
My use case is that I have 3 containers in the server and I have to collect logs using FIleBeat from only a specific one.  
I cannot use container ID because this container can change so my idea was to do it by container name (that would be the same all the time).

My configuration bellow does not send any logs to elastic.  
The autodiscover configuration can be used without filebeat docker input?

(The documentation is not very clear on this)

* * *

filebeat.autodiscover:

providers:  
- type: docker  
templates:  
- condition:  
contains:  
docker.container.name: SPECIFIC\_CONTAINER  
config:  
- type: log  
paths:  
- /var/lib/docker/containers/${data.docker.container.id}/\*.log

---

<div class="post-metadata">

**Author:** ![Tiago\_Silva1](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tiago\_Silva1](https://discuss.elastic.co/u/Tiago_Silva1)\
**Post date:** [March 8, 2019, 2:51pm UTC](https://discuss.elastic.co/t/is-there-support-for-selecting-containers-other-than-by-container-id/168125/4 "2019-03-08T14:51:18Z")

</div>

Another similar post is this one: [Problem getting autodiscover docker to work with filebeat](https://discuss.elastic.co/t/problem-getting-autodiscover-docker-to-work-with-filebeat/144349/11)

In the last reply states the same doubt i am having, how to use filebeat input together with autodiscover, and then filter only a specific container with certain name and new ones appearing with the same container image.

(This would be helpfull also because there are containers like filebeat that i dont want to get inputs from),

---

<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:** [April 5, 2019, 2:51pm UTC](https://discuss.elastic.co/t/is-there-support-for-selecting-containers-other-than-by-container-id/168125/5 "2019-04-05T14:51:21Z")

</div>

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