# Autodiscover questions

**URL:** <https://discuss.elastic.co/t/autodiscover-questions/175154>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [April 3, 2019, 10:05am UTC](https://discuss.elastic.co/t/autodiscover-questions/175154 "2019-04-03T10:05:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jof300](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jof300](https://discuss.elastic.co/u/jof300)\
**Post date:** [April 3, 2019, 10:05am UTC](https://discuss.elastic.co/t/autodiscover-questions/175154/1 "2019-04-03T10:05:18Z")

</div>

Hi,

I was wondering how filebeat collects containers logs when filebeat is also a container?

Are logs read from a path ?  
Are logs pulled from container (ex : nginx) and sent to filebeat?  
Should volumes (/var/run/docker.sock, /var/lib/docker, etc...) be mounted in filebeat container?

Any full config file example ?

Thx

---

<div class="post-metadata">

**Author:** ![Michal\_Pristas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_pristas/32/46639_2.png) [@Michal\_Pristas](https://discuss.elastic.co/u/Michal_Pristas)\
**Post date:** [April 3, 2019, 4:04pm UTC](https://discuss.elastic.co/t/autodiscover-questions/175154/2 "2019-04-03T16:04:44Z")

</div>

How it works is that it hooks up to the events emitted let's say by docker.  
Then listener listens for start/stop events, compile metadata and emits event by itself, contestable by ELK.  
Implementation wise, you can check [autodiscover docker provider](https://github.com/elastic/beats/blob/master/libbeat/autodiscover/providers/docker/docker.go)  
and its [watcher](https://github.com/elastic/beats/blob/master/libbeat/common/docker/watcher.go)

Configuration wise (but I'm not sure if this is what you had in mind):

```auto
filebeat.autodiscover:
  providers:
    - type: docker
      labels.dedot: true
      templates:
        - condition:
            contains:
              docker.container.image: redis
          config:
            - type: docker
              containers.ids:
                - "${data.docker.container.id}"
              exclude_lines: ["^\\s+[\\-`('.|_]"] # drop asciiart lines

```

This configuration launches a `docker` logs input for all  
containers running an image with `redis` in the name.  
`labels.dedot` defaults to be `true` for docker autodiscover,  
which means dots in docker labels are replaced with '\_' by default.

---

<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:** [May 1, 2019, 4:04pm UTC](https://discuss.elastic.co/t/autodiscover-questions/175154/3 "2019-05-01T16:04:49Z")

</div>

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