# How to set the JVM Garbage Collector logs to the stdout and not in /var/log/elasticsearch/gc.log

**URL:** <https://discuss.elastic.co/t/how-to-set-the-jvm-garbage-collector-logs-to-the-stdout-and-not-in-var-log-elasticsearch-gc-log/206922>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [November 7, 2019, 8:16am UTC](https://discuss.elastic.co/t/how-to-set-the-jvm-garbage-collector-logs-to-the-stdout-and-not-in-var-log-elasticsearch-gc-log/206922 "2019-11-07T08:16:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![missmarior](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@missmarior](https://discuss.elastic.co/u/missmarior)\
**Post date:** [November 7, 2019, 8:16am UTC](https://discuss.elastic.co/t/how-to-set-the-jvm-garbage-collector-logs-to-the-stdout-and-not-in-var-log-elasticsearch-gc-log/206922/1 "2019-11-07T08:16:53Z")

</div>

Hello,

I would like to put an option in my docker-compose.yml (ES\_JAVA\_OPTS) to say at the JVM to write logs on the stdout but if I give the stdout path, it says that I don't have the rights ("permission denied") and I can't find any option to do that.. Is there a solution ?

I have seen that in /etc/elasticsearch/ there is a file jvm.options where the logs file path is specified :

> -Xloggc:/var/log/elasticsearch/gc.log

Maybe is it possible to specify on the docker-compose to change this path to stdout or comment this line for let the default jvm parameter which is to write logs on the stdout ?

Please give me some ideas, I really don't know how to do 😅

PS : when I change for example the name of the log file ("ES\_JAVA\_OPTS: -Xms1G -Xmx1G -Xloggc:/var/log/elasticsearch/gc\_test.log" in docker-compose.yml), it works. It's just the stdout that doesn't work..

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 7, 2019, 8:54am UTC](https://discuss.elastic.co/t/how-to-set-the-jvm-garbage-collector-logs-to-the-stdout-and-not-in-var-log-elasticsearch-gc-log/206922/2 "2019-11-07T08:54:41Z")

</div>

IIRC the default output is stdout, as long as the jvm options to print gc times are set, you can omit `-Xloggc` and then everything should be written to stdout.

---

<div class="post-metadata">

**Author:** ![missmarior](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@missmarior](https://discuss.elastic.co/u/missmarior)\
**Post date:** [November 7, 2019, 9:03am UTC](https://discuss.elastic.co/t/how-to-set-the-jvm-garbage-collector-logs-to-the-stdout-and-not-in-var-log-elasticsearch-gc-log/206922/3 "2019-11-07T09:03:58Z")

</div>

Thanks for your answer,  
Yes normally it's like that but ES change JVM default options so even if I don't specify `-Xloggc` in my docker-compose, it follows the ES jvm.options file which is in the docker container.. I would like to say in the docker-compose file to write JVM logs in the stdout and not to listen the jvm.options 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:** [December 5, 2019, 9:04am UTC](https://discuss.elastic.co/t/how-to-set-the-jvm-garbage-collector-logs-to-the-stdout-and-not-in-var-log-elasticsearch-gc-log/206922/4 "2019-12-05T09:04:16Z")

</div>

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