# Filebeat: Persist processed logs if docker container crashes

**URL:** https://discuss.elastic.co/t/filebeat-persist-processed-logs-if-docker-container-crashes/60089
**Category:** Beats
**Tags:** filebeat
**Created:** [September 8, 2016, 3:35pm UTC](https://discuss.elastic.co/t/filebeat-persist-processed-logs-if-docker-container-crashes/60089 "2016-09-08T15:35:34Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![dantze](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@dantze](https://discuss.elastic.co/u/dantze)
#### Post date: [September 8, 2016, 3:35pm UTC](https://discuss.elastic.co/t/filebeat-persist-processed-logs-if-docker-container-crashes/60089/1 "2016-09-08T15:35:34Z")

</div>

I'm running Filebeat on several docker containers using this Dockerfile: [https://github.com/primait/docker-filebeat/blob/master/1.2/Dockerfile](https://github.com/primait/docker-filebeat/blob/master/1.2/Dockerfile)

When the container for some reason crashes or goes down I need to make sure that the processed logs up to that point are not reprocessed again, leading to a big chunk of duplicated logs on the ELK. I need to avoid this.

From this page [directory-layout](https://www.elastic.co/guide/en/beats/filebeat/master/directory-layout.html) I get that the data folder (path.data) is where filebeat keeps the processed logs registered. Am I right?

My filebeat.yml has this entry:  
file:  
path: "/etc/filebeat"  
path.data: "/etc/filebeat/data"

But when I enter the docker container and navigate to /etc/filebeat/data I see an empty folder and I'm 100% sure Filebeat is processing logs because I see them live on Kibana.

Can someone help me out here?  
Basically my intention is to prevent process the same log entries multiple times in case the docker container crashes.

---

<div class="post-metadata">

### Author: ![dantze](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@dantze](https://discuss.elastic.co/u/dantze)
#### Post date: [September 8, 2016, 5:59pm UTC](https://discuss.elastic.co/t/filebeat-persist-processed-logs-if-docker-container-crashes/60089/2 "2016-09-08T17:59:15Z")

</div>

I shut down the docker container with Filebeat. On Kibana a selected a time window with logs and then I restarted the Filebeat container several times and on the Kibana dashboard for that exact time window I see no duplicated entries neither an increase of logs.

This leaves me wondering why there's no duplicated log entries for that time window as I expected Filebeat to reprocess the logs every time it starts (the container is recreated).

Am I missing something here?

My coworker said he suspects that Filebeat reprocesses the log every time it starts (the container is recreated) and asked me to investigate a way to fix this (he's currently out of office).

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [September 9, 2016, 6:07am UTC](https://discuss.elastic.co/t/filebeat-persist-processed-logs-if-docker-container-crashes/60089/3 "2016-09-09T06:07:54Z")

</div>

> From this page directory-layout I get that the data folder (path.data) is where filebeat keeps the processed logs registered. Am I right?

Yes: [Configure general settings | Filebeat Reference [master] | Elastic](https://www.elastic.co/guide/en/beats/filebeat/master/configuration-global-options.html#_registry_file)

> But when I enter the docker container and navigate to /etc/filebeat/data I see an empty folder and I'm 100% sure Filebeat is processing logs because I see them live on Kibana.

That's a bit surprising. Filebeat does log the location of the registry file so I'd check in the log. You might have to bump the log level.

> This leaves me wondering why there's no duplicated log entries for that time window as I expected Filebeat to reprocess the logs every time it starts (the container is recreated).

Is the registry file stored in a persistent volume? It should be, but if it's not and therefore lost when the container is recreated I'd also expect any remaining logs to be shipped again.

---

<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: [September 9, 2016, 6:15am UTC](https://discuss.elastic.co/t/filebeat-persist-processed-logs-if-docker-container-crashes/60089/4 "2016-09-09T06:15:06Z")

</div>

Alternatively instead of running filebeat in each container, you could run one container with filebeat and mount the docker logs volumes into the container for processing. Liek this filebeat keeps running if one of your containers stops.

---

<div class="post-metadata">

### Author: ![dantze](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@dantze](https://discuss.elastic.co/u/dantze)
#### Post date: [September 9, 2016, 5:33pm UTC](https://discuss.elastic.co/t/filebeat-persist-processed-logs-if-docker-container-crashes/60089/5 "2016-09-09T17:33:12Z")

</div>

Thanks for your help guys.  
This is exactly what I was looking for: [https://www.elastic.co/guide/en/beats/filebeat/1.2/configuration-filebeat-options.html#\_registry\_file](https://www.elastic.co/guide/en/beats/filebeat/1.2/configuration-filebeat-options.html#_registry_file)

---

<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: [September 29, 2016, 3:35pm UTC](https://discuss.elastic.co/t/filebeat-persist-processed-logs-if-docker-container-crashes/60089/6 "2016-09-29T15:35:51Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
