# Collecting docker logs using filebeat

**URL:** <https://discuss.elastic.co/t/collecting-docker-logs-using-filebeat/77675>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [March 7, 2017, 2:01pm UTC](https://discuss.elastic.co/t/collecting-docker-logs-using-filebeat/77675 "2017-03-07T14:01:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohitC](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@rohitC](https://discuss.elastic.co/u/rohitC)\
**Post date:** [March 7, 2017, 2:01pm UTC](https://discuss.elastic.co/t/collecting-docker-logs-using-filebeat/77675/1 "2017-03-07T14:01:07Z")

</div>

Hi,

I want to collect logs(with container metadata like container id, image name, host machine) of applications running in containers deployed on more than one host machines using Mesos-Marathon. After some initial investigation, I have decided to use elastic search, filebeat and Kibana.  
Which way is good to go:

1. Running filebeat inside each container, or
2. Running filebeat per host, or
3. any other way?

If we select option 2 above, how to add container metadata with logs? If I make one prospector per container with dynamically populated tags/fields as that container's metadata, how to continuously check for any new containers coming up and add corresponding new prospectors?

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [March 11, 2017, 4:13pm UTC](https://discuss.elastic.co/t/collecting-docker-logs-using-filebeat/77675/2 "2017-03-11T16:13:53Z")

</div>

I would definitively go with option 2. For the meta data: You would need a script that checks the container stats to check for new containers or have each new container write its config file itself (trough a script). We are aware that this is not optimal yet and working on ideas on how we could improve this.

---

<div class="post-metadata">

**Author:** ![rohitC](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@rohitC](https://discuss.elastic.co/u/rohitC)\
**Post date:** [March 11, 2017, 4:41pm UTC](https://discuss.elastic.co/t/collecting-docker-logs-using-filebeat/77675/3 "2017-03-11T16:41:56Z")

</div>

Thanks @ruflin for your reply.

---

<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 8, 2017, 4:42pm UTC](https://discuss.elastic.co/t/collecting-docker-logs-using-filebeat/77675/4 "2017-04-08T16:42:16Z")

</div>

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