# Docker autodiscover feature: losing tail of logs when container gets stopped

**URL:** <https://discuss.elastic.co/t/docker-autodiscover-feature-losing-tail-of-logs-when-container-gets-stopped/137060>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [June 22, 2018, 4:48pm UTC](https://discuss.elastic.co/t/docker-autodiscover-feature-losing-tail-of-logs-when-container-gets-stopped/137060 "2018-06-22T16:48:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smamontov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smamontov/32/32588_2.png) [@smamontov](https://discuss.elastic.co/u/smamontov)\
**Post date:** [June 22, 2018, 4:48pm UTC](https://discuss.elastic.co/t/docker-autodiscover-feature-losing-tail-of-logs-when-container-gets-stopped/137060/1 "2018-06-22T16:48:25Z")

</div>

I'm running docker container without --rm option to make sure this is not because log file is removed by docker. The problem is that not all events are getting sent to elasticsearch: messages are ignored since the point when docker spawns stop event, because autodiscover manager closes harvester too early:

```
WARN	[cfgwarn]	docker/input.go:29	EXPERIMENTAL: Docker input is enabled.
INFO	log/input.go:111	Configured paths: [/var/lib/docker/containers/f50305f7/*.log]
INFO	autodiscover/autodiscover.go:144	Autodiscover starting runner: input [type=docker, ID=1190163555171836425]
INFO	input/input.go:87	Starting input of type: docker; ID: 1190163555171836425 
INFO	log/harvester.go:228	Harvester started for file: /var/lib/docker/containers/f50305f7/f50305f7-json.log

```

... after 10 seconds ...

```
INFO	autodiscover/autodiscover.go:181	Autodiscover stopping runner: input [type=docker, ID=1190163555171836425]
INFO	input/input.go:121	input ticker stopped
INFO	input/input.go:138	Stopping Input: 1190163555171836425
INFO	log/harvester.go:249	Reader was closed: /var/lib/docker/containers/f50305f7/f50305f7-json.log. Closing.

```

After inspecting events in my index, I've realized only 530 first messages were indexed out of 568.

Is there any solution?

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [June 25, 2018, 4:22pm UTC](https://discuss.elastic.co/t/docker-autodiscover-feature-losing-tail-of-logs-when-container-gets-stopped/137060/2 "2018-06-25T16:22:27Z")

</div>

I think this can be related with this issue [https://github.com/elastic/beats/issues/6694](https://github.com/elastic/beats/issues/6694)

---

<div class="post-metadata">

**Author:** ![smamontov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smamontov/32/32588_2.png) [@smamontov](https://discuss.elastic.co/u/smamontov)\
**Post date:** [June 26, 2018, 12:58pm UTC](https://discuss.elastic.co/t/docker-autodiscover-feature-losing-tail-of-logs-when-container-gets-stopped/137060/3 "2018-06-26T12:58:43Z")

</div>

Thank you!

---

<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:** [July 24, 2018, 12:58pm UTC](https://discuss.elastic.co/t/docker-autodiscover-feature-losing-tail-of-logs-when-container-gets-stopped/137060/4 "2018-07-24T12:58:59Z")

</div>

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