# Filebeat container config

**URL:** https://discuss.elastic.co/t/filebeat-container-config/73574
**Category:** Beats
**Tags:** filebeat
**Created:** [February 1, 2017, 6:59pm UTC](https://discuss.elastic.co/t/filebeat-container-config/73574 "2017-02-01T18:59:28Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![DougD](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@DougD](https://discuss.elastic.co/u/DougD)
#### Post date: [February 1, 2017, 6:59pm UTC](https://discuss.elastic.co/t/filebeat-container-config/73574/1 "2017-02-01T18:59:28Z")

</div>

Greetings,

I'm new to filebeat and trying to understand how to setup a filebeat container to process the logs from several application containers each creating logs at /app/log/\*.log

Will this work?

docker run -d -v /app/log --name FB filebeat-image  
docker run -d --volumes-from FB --name APP1 app-image  
docker run -d --volumes-from FB --name APP2 app-image

OR

docker run -v /app/log --name APP1 app-image  
docker run -v /app/log --name APP2 app-image  
docker run --volumes-from APP1 --volumes-from APP2 --name FB filebeat-image

OR

what is the best practice?

Thank you,

Doug

---

<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: [February 2, 2017, 8:06am UTC](https://discuss.elastic.co/t/filebeat-container-config/73574/2 "2017-02-02T08:06:45Z")

</div>

I personally would recommend approach one because it works with dynamically adding and removing containers. In your second version you already need to know all containers on start up.

The version I would recommend is to write logs to somewhere on the host machine and mount this into a filebeat container so the logs are not "linked" to any container directly.

---

<div class="post-metadata">

### Author: ![nsphaniraj](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@nsphaniraj](https://discuss.elastic.co/u/nsphaniraj)
#### Post date: [February 6, 2017, 6:03pm UTC](https://discuss.elastic.co/t/filebeat-container-config/73574/3 "2017-02-06T18:03:35Z")

</div>

What happens to the state of the file when the filebeat container restarts? Does the newly created/restarted container resumes harvesting the file from where it has left?

**Example** :  
Suppose, i start filebeat container and the container harvests 5 lines of log data i.e. /var/log/elasticsearch/elasticsearch.log of the host machine where the container is running. The filebeat container crashes/restarts. When the filebeat container is back, does the harvesting happens from 6th line?

---

<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: [February 7, 2017, 3:57pm UTC](https://discuss.elastic.co/t/filebeat-container-config/73574/4 "2017-02-07T15:57:12Z")

</div>

This depends on where you store the registry file. If the registry file is on a volume that you will reuse, then it will continue. If the registry file disappears with the container, then not.

---

<div class="post-metadata">

### Author: ![nsphaniraj](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@nsphaniraj](https://discuss.elastic.co/u/nsphaniraj)
#### Post date: [February 7, 2017, 4:23pm UTC](https://discuss.elastic.co/t/filebeat-container-config/73574/5 "2017-02-07T16:23:45Z")

</div>

Hi ruflin,

It makes more sense to resume from where it has halted. At least in my scenario. How do we control the location of registry file?

Appreciate it!

Thanks  
Phaniraj

---

<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: [February 8, 2017, 1:21pm UTC](https://discuss.elastic.co/t/filebeat-container-config/73574/6 "2017-02-08T13:21:13Z")

</div>

See [https://www.elastic.co/guide/en/beats/filebeat/5.2/configuration-global-options.html#\_registry\_file](https://www.elastic.co/guide/en/beats/filebeat/5.2/configuration-global-options.html#_registry_file)

---

<div class="post-metadata">

### Author: ![nsphaniraj](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@nsphaniraj](https://discuss.elastic.co/u/nsphaniraj)
#### Post date: [February 16, 2017, 6:13am UTC](https://discuss.elastic.co/t/filebeat-container-config/73574/7 "2017-02-16T06:13:33Z")

</div>

Thanks ruflin,

I will map the container registry\_file value to host location.

Appreciate your help!

---

<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: [March 16, 2017, 6:13am UTC](https://discuss.elastic.co/t/filebeat-container-config/73574/8 "2017-03-16T06:13:33Z")

</div>

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