# How to collect elasticsearch logs in docker

**URL:** <https://discuss.elastic.co/t/how-to-collect-elasticsearch-logs-in-docker/207448>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [November 12, 2019, 6:43am UTC](https://discuss.elastic.co/t/how-to-collect-elasticsearch-logs-in-docker/207448 "2019-11-12T06:43:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![MiTschMR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mitschmr/32/48254_2.png) [@MiTschMR](https://discuss.elastic.co/u/MiTschMR)\
**Post date:** [November 12, 2019, 7:15am UTC](https://discuss.elastic.co/t/how-to-collect-elasticsearch-logs-in-docker/207448/2 "2019-11-12T07:15:00Z")

</div>

Hi @Petr.Simik

To get Elasticsearch write the logs to file you either need to do some hacky stuff with docker and the command parameters or modify the log4j2.properties file. I advise you to check out the following site:  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/logging.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/logging.html)

You need to map the new log4j2.properties to the containers and also need a folder mapped into the directory you want to save the logs.

Hope this leads you on the right way.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-collect-elasticsearch-logs-in-docker/207448)._
