# How to enable Garbage Collector logging in an elastic search nodes

**URL:** <https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487>\
**Category:** Elasticsearch\
**Created:** [March 3, 2015, 12:11pm UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487 "2015-03-03T12:11:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anil\_Karaka](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Anil\_Karaka](https://discuss.elastic.co/u/Anil_Karaka)\
**Post date:** [March 3, 2015, 12:11pm UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/1 "2015-03-03T12:11:20Z")

</div>

Some of the nodes are leaving the cluster from time to time..

I un commented the GC Logging options in elasticsearch.yml file as shown  
and restarted my node.

################################## GC Logging  
################################

monitor.jvm.gc.young.warn: 1000ms  
monitor.jvm.gc.young.info: 700ms  
monitor.jvm.gc.young.debug: 400ms

monitor.jvm.gc.old.warn: 10s  
monitor.jvm.gc.old.info: 5s  
monitor.jvm.gc.old.debug: 2s

yet I'm not able to see any of the GC logging..

I came across this blog post  
[http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/](http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/)

`ElasticSearch will note in its normal logs if any GC is happening which  
effects a slow query, but we wanted more detail. Another logging option  
ElasticSearch has is ES\_USE\_GC\_LOGGING which sets some JVM variables:

# from elasticsearch.in.sh.erbif ["x$ES\_USE\_GC\_LOGGING" != "x"]; then

JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"fi

`  
Where do I set the ES\_USE\_GC\_LOGGING option in my node..  
so that I can log GC events..

currently there is no gc.log file in my logs folder..  
just normal cluster logs and slow index/search logs..

Thanks..

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 3, 2015, 9:40pm UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/2 "2015-03-03T21:40:53Z")

</div>

You can set JAVA\_OPTS in /etc/default/elasticsearch or  
/etc/sysconfig/elasticsearch u9nder ES\_JAVA\_OPTS

On 3 March 2015 at 23:11, Anil Karaka [anilkaraka@gmail.com](mailto:anilkaraka@gmail.com) wrote:

> Some of the nodes are leaving the cluster from time to time..
> 
> I un commented the GC Logging options in elasticsearch.yml file as shown  
> and restarted my node.
> 
> ################################## GC Logging  
> ################################
> 
> monitor.jvm.gc.young.warn: 1000ms  
> monitor.jvm.gc.young.info: 700ms  
> monitor.jvm.gc.young.debug: 400ms
> 
> monitor.jvm.gc.old.warn: 10s  
> monitor.jvm.gc.old.info: 5s  
> monitor.jvm.gc.old.debug: 2s
> 
> yet I'm not able to see any of the GC logging..
> 
> I came across this blog post  
> [http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/](http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/)
> 
> `Elasticsearch will note in its normal logs if any GC is happening which  
> effects a slow query, but we wanted more detail. Another logging option  
> Elasticsearch has is ES\_USE\_GC\_LOGGING which sets some JVM variables:
> 
> # from elasticsearch.in.sh.erbif ["x$ES\_USE\_GC\_LOGGING" != "x"]; then
> 
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"fi
> 
> `  
> Where do I set the ES\_USE\_GC\_LOGGING option in my node..  
> so that I can log GC events..
> 
> currently there is no gc.log file in my logs folder..  
> just normal cluster logs and slow index/search logs..
> 
> Thanks..
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-Ot8p9iprmX73\_jtP0NsZGvsYR\_4wweBbD-r9i8TDewg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-Ot8p9iprmX73_jtP0NsZGvsYR_4wweBbD-r9i8TDewg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Anil\_Karaka](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Anil\_Karaka](https://discuss.elastic.co/u/Anil_Karaka)\
**Post date:** [March 4, 2015, 2:22pm UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/3 "2015-03-04T14:22:50Z")

</div>

Can you please tell me what exactly do I need to add in  
/etc/default/elasticsearch?

What should I set ES\_USE\_GC\_LOGGING to?

I added below line in my dev ES node, and I didn't see the gc.log file in  
my log folder.. I want to be sure what to do before changing anything in my  
production cluster..

ES\_USE\_GC\_LOGGING=true

And what are the GC logging options in my elasticsearch.yml do? where do  
those logs appear?

Thank you.

On Wednesday, March 4, 2015 at 3:11:26 AM UTC+5:30, Mark Walkom wrote:

> You can set JAVA\_OPTS in /etc/default/elasticsearch or  
> /etc/sysconfig/elasticsearch u9nder ES\_JAVA\_OPTS
> 
> On 3 March 2015 at 23:11, Anil Karaka \<[anilk...@gmail.com](mailto:anilk...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Some of the nodes are leaving the cluster from time to time..
> > 
> > I un commented the GC Logging options in elasticsearch.yml file as shown  
> > and restarted my node.
> > 
> > ################################## GC Logging  
> > ################################
> > 
> > monitor.jvm.gc.young.warn: 1000ms  
> > monitor.jvm.gc.young.info: 700ms  
> > monitor.jvm.gc.young.debug: 400ms
> > 
> > monitor.jvm.gc.old.warn: 10s  
> > monitor.jvm.gc.old.info: 5s  
> > monitor.jvm.gc.old.debug: 2s
> > 
> > yet I'm not able to see any of the GC logging..
> > 
> > I came across this blog post  
> > [http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/](http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/)
> > 
> > `Elasticsearch will note in its normal logs if any GC is happening which  
> > effects a slow query, but we wanted more detail. Another logging option  
> > Elasticsearch has is ES\_USE\_GC\_LOGGING which sets some JVM variables:
> > 
> > # from elasticsearch.in.sh.erbif ["x$ES\_USE\_GC\_LOGGING" != "x"]; then
> > 
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"fi
> > 
> > `  
> > Where do I set the ES\_USE\_GC\_LOGGING option in my node..  
> > so that I can log GC events..
> > 
> > currently there is no gc.log file in my logs folder..  
> > just normal cluster logs and slow index/search logs..
> > 
> > Thanks..
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6410585d-a272-4ff3-a58e-bacee4d53db0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6410585d-a272-4ff3-a58e-bacee4d53db0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Gavin\_Seng](https://avatars.discourse-cdn.com/v4/letter/g/e56c9b/32.png) [@Gavin\_Seng](https://discuss.elastic.co/u/Gavin_Seng)\
**Post date:** [March 14, 2015, 1:48am UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/4 "2015-03-14T01:48:29Z")

</div>

Anil, you can try this:

# /etc/sysconfig/elasticsearch

export ES\_USE\_GC\_LOGGING=1  
ES\_JAVA\_OPTS="-verbose:gc -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation  
-XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M -Xloggc:"

Gavin

On Wednesday, March 4, 2015 at 9:22:50 AM UTC-5, Anil Karaka wrote:

> Can you please tell me what exactly do I need to add in  
> /etc/default/elasticsearch?
> 
> What should I set ES\_USE\_GC\_LOGGING to?
> 
> I added below line in my dev ES node, and I didn't see the gc.log file in  
> my log folder.. I want to be sure what to do before changing anything in my  
> production cluster..
> 
> ES\_USE\_GC\_LOGGING=true
> 
> And what are the GC logging options in my elasticsearch.yml do? where do  
> those logs appear?
> 
> Thank you.
> 
> On Wednesday, March 4, 2015 at 3:11:26 AM UTC+5:30, Mark Walkom wrote:
> 
> > You can set JAVA\_OPTS in /etc/default/elasticsearch or  
> > /etc/sysconfig/elasticsearch u9nder ES\_JAVA\_OPTS
> > 
> > On 3 March 2015 at 23:11, Anil Karaka [anilk...@gmail.com](mailto:anilk...@gmail.com) wrote:
> > 
> > > Some of the nodes are leaving the cluster from time to time..
> > > 
> > > I un commented the GC Logging options in elasticsearch.yml file as shown  
> > > and restarted my node.
> > > 
> > > ################################## GC Logging  
> > > ################################
> > > 
> > > monitor.jvm.gc.young.warn: 1000ms  
> > > monitor.jvm.gc.young.info: 700ms  
> > > monitor.jvm.gc.young.debug: 400ms
> > > 
> > > monitor.jvm.gc.old.warn: 10s  
> > > monitor.jvm.gc.old.info: 5s  
> > > monitor.jvm.gc.old.debug: 2s
> > > 
> > > yet I'm not able to see any of the GC logging..
> > > 
> > > I came across this blog post  
> > > [http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/](http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/)
> > > 
> > > `Elasticsearch will note in its normal logs if any GC is happening  
> > > which effects a slow query, but we wanted more detail. Another logging  
> > > option Elasticsearch has is ES\_USE\_GC\_LOGGING which sets some JVM  
> > > variables:
> > > 
> > > # from elasticsearch.in.sh.erbif ["x$ES\_USE\_GC\_LOGGING" != "x"]; then
> > > 
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"fi
> > > 
> > > `  
> > > Where do I set the ES\_USE\_GC\_LOGGING option in my node..  
> > > so that I can log GC events..
> > > 
> > > currently there is no gc.log file in my logs folder..  
> > > just normal cluster logs and slow index/search logs..
> > > 
> > > Thanks..
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6c00bb3e-157b-4476-85b9-ba1a058d2d87%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6c00bb3e-157b-4476-85b9-ba1a058d2d87%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Anil\_Karaka](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Anil\_Karaka](https://discuss.elastic.co/u/Anil_Karaka)\
**Post date:** [April 1, 2015, 7:08am UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/5 "2015-04-01T07:08:34Z")

</div>

Thanks,

I just kept those GC logging options outside the if block.. So that I don't  
have to set that variable, and enabled GC logging by default.

this is in the file /usr/share/elasticsearch/bin/elasticsearch.in.sh

# GC logging options

if ["x$ES\_USE\_GC\_LOGGING" != "x"]; then  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"  
fi

# Enable gc logging by default

JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"

On Saturday, March 14, 2015 at 7:18:29 AM UTC+5:30, Gavin Seng wrote:

> Anil, you can try this:
> 
> # /etc/sysconfig/elasticsearch
> 
> export ES\_USE\_GC\_LOGGING=1  
> ES\_JAVA\_OPTS="-verbose:gc -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation  
> -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M -Xloggc:"
> 
> Gavin
> 
> On Wednesday, March 4, 2015 at 9:22:50 AM UTC-5, Anil Karaka wrote:
> 
> > Can you please tell me what exactly do I need to add in  
> > /etc/default/elasticsearch?
> > 
> > What should I set ES\_USE\_GC\_LOGGING to?
> > 
> > I added below line in my dev ES node, and I didn't see the gc.log file in  
> > my log folder.. I want to be sure what to do before changing anything in my  
> > production cluster..
> > 
> > ES\_USE\_GC\_LOGGING=true
> > 
> > And what are the GC logging options in my elasticsearch.yml do? where do  
> > those logs appear?
> > 
> > Thank you.
> > 
> > On Wednesday, March 4, 2015 at 3:11:26 AM UTC+5:30, Mark Walkom wrote:
> > 
> > > You can set JAVA\_OPTS in /etc/default/elasticsearch or  
> > > /etc/sysconfig/elasticsearch u9nder ES\_JAVA\_OPTS
> > > 
> > > On 3 March 2015 at 23:11, Anil Karaka [anilk...@gmail.com](mailto:anilk...@gmail.com) wrote:
> > > 
> > > > Some of the nodes are leaving the cluster from time to time..
> > > > 
> > > > I un commented the GC Logging options in elasticsearch.yml file as  
> > > > shown and restarted my node.
> > > > 
> > > > ################################## GC Logging  
> > > > ################################
> > > > 
> > > > monitor.jvm.gc.young.warn: 1000ms  
> > > > monitor.jvm.gc.young.info: 700ms  
> > > > monitor.jvm.gc.young.debug: 400ms
> > > > 
> > > > monitor.jvm.gc.old.warn: 10s  
> > > > monitor.jvm.gc.old.info: 5s  
> > > > monitor.jvm.gc.old.debug: 2s
> > > > 
> > > > yet I'm not able to see any of the GC logging..
> > > > 
> > > > I came across this blog post  
> > > > [http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/](http://tech.taskrabbit.com/blog/2014/07/18/elasticsearch-in-production/)
> > > > 
> > > > `Elasticsearch will note in its normal logs if any GC is happening  
> > > > which effects a slow query, but we wanted more detail. Another logging  
> > > > option Elasticsearch has is ES\_USE\_GC\_LOGGING which sets some JVM  
> > > > variables:
> > > > 
> > > > # from elasticsearch.in.sh.erbif ["x$ES\_USE\_GC\_LOGGING" != "x"]; then
> > > > 
> > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > > > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"fi
> > > > 
> > > > `  
> > > > Where do I set the ES\_USE\_GC\_LOGGING option in my node..  
> > > > so that I can log GC events..
> > > > 
> > > > currently there is no gc.log file in my logs folder..  
> > > > just normal cluster logs and slow index/search logs..
> > > > 
> > > > Thanks..
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 1, 2015, 9:32pm UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/6 "2015-04-01T21:32:02Z")

</div>

It's not recommended to alter the .in.sh, this file can change between  
releases and your alterations can either be lost or can cause other  
problems.

I'd suggest you do what Gavin mentioned.

On 1 April 2015 at 18:08, Anil Karaka [anilkaraka@gmail.com](mailto:anilkaraka@gmail.com) wrote:

> Thanks,
> 
> I just kept those GC logging options outside the if block.. So that I  
> don't have to set that variable, and enabled GC logging by default.
> 
> this is in the file /usr/share/elasticsearch/bin/elasticsearch.in.sh
> 
> # GC logging options
> 
> if ["x$ES\_USE\_GC\_LOGGING" != "x"]; then  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"  
> fi
> 
> # Enable gc logging by default
> 
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"
> 
> On Saturday, March 14, 2015 at 7:18:29 AM UTC+5:30, Gavin Seng wrote:
> 
> > Anil, you can try this:
> > 
> > # /etc/sysconfig/elasticsearch
> > 
> > export ES\_USE\_GC\_LOGGING=1  
> > ES\_JAVA\_OPTS="-verbose:gc -XX:+PrintGCDateStamps  
> > -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M  
> > -Xloggc:"
> > 
> > Gavin
> > 
> > On Wednesday, March 4, 2015 at 9:22:50 AM UTC-5, Anil Karaka wrote:
> > 
> > > Can you please tell me what exactly do I need to add in  
> > > /etc/default/elasticsearch?
> > > 
> > > What should I set ES\_USE\_GC\_LOGGING to?
> > > 
> > > I added below line in my dev ES node, and I didn't see the gc.log file  
> > > in my log folder.. I want to be sure what to do before changing anything in  
> > > my production cluster..
> > > 
> > > ES\_USE\_GC\_LOGGING=true
> > > 
> > > And what are the GC logging options in my elasticsearch.yml do? where do  
> > > those logs appear?
> > > 
> > > Thank you.
> > > 
> > > On Wednesday, March 4, 2015 at 3:11:26 AM UTC+5:30, Mark Walkom wrote:
> > > 
> > > > You can set JAVA\_OPTS in /etc/default/elasticsearch or  
> > > > /etc/sysconfig/elasticsearch u9nder ES\_JAVA\_OPTS
> > > > 
> > > > On 3 March 2015 at 23:11, Anil Karaka [anilk...@gmail.com](mailto:anilk...@gmail.com) wrote:
> > > > 
> > > > > Some of the nodes are leaving the cluster from time to time..
> > > > > 
> > > > > I un commented the GC Logging options in elasticsearch.yml file as  
> > > > > shown and restarted my node.
> > > > > 
> > > > > ################################## GC Logging  
> > > > > ################################
> > > > > 
> > > > > monitor.jvm.gc.young.warn: 1000ms  
> > > > > monitor.jvm.gc.young.info: 700ms  
> > > > > monitor.jvm.gc.young.debug: 400ms
> > > > > 
> > > > > monitor.jvm.gc.old.warn: 10s  
> > > > > monitor.jvm.gc.old.info: 5s  
> > > > > monitor.jvm.gc.old.debug: 2s
> > > > > 
> > > > > yet I'm not able to see any of the GC logging..
> > > > > 
> > > > > I came across this blog post [http://tech.taskrabbit.com/](http://tech.taskrabbit.com/)  
> > > > > blog/2014/07/18/elasticsearch-in-production/
> > > > > 
> > > > > `Elasticsearch will note in its normal logs if any GC is happening  
> > > > > which effects a slow query, but we wanted more detail. Another logging  
> > > > > option Elasticsearch has is ES\_USE\_GC\_LOGGING which sets some JVM  
> > > > > variables:
> > > > > 
> > > > > # from elasticsearch.in.sh.erbif ["x$ES\_USE\_GC\_LOGGING" != "x"]; then
> > > > > 
> > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > > > > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"fi
> > > > > 
> > > > > `  
> > > > > Where do I set the ES\_USE\_GC\_LOGGING option in my node..  
> > > > > so that I can log GC events..
> > > > > 
> > > > > currently there is no gc.log file in my logs folder..  
> > > > > just normal cluster logs and slow index/search logs..
> > > > > 
> > > > > Thanks..
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%  
> > > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google Groups  
> > > > "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEYi1X9GS%3DVhkmGncprhw4LGDko48hAGY3F15-vk-B50nayhgA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEYi1X9GS%3DVhkmGncprhw4LGDko48hAGY3F15-vk-B50nayhgA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Anil\_Karaka](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Anil\_Karaka](https://discuss.elastic.co/u/Anil_Karaka)\
**Post date:** [April 2, 2015, 5:49am UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/7 "2015-04-02T05:49:47Z")

</div>

Ok, we also had to edit that file to change the default garbage collector  
options and are now using G1GC. So I thought I will just change the if  
condition to enable gc logs..

Any way, this is not the main problem, I'm trying to do all these things to  
debug the main issue of my nodes leaving the cluster randomly.  
[Redirecting to Google Groups](https://groups.google.com/forum/#!topic/elasticsearch/E-aGhovVTPI) here are  
more details. Any help would be appreciated.

Yesterday night I increased the zen.ping.timeout from 3s to 10s of all my  
machines and restarted them one by one, and yet to see if its any  
improvement.  
Will updating elasticsearch in my nodes fix my issues? Currently my nodes  
are using ES-1.4.1.

Thanks.

On Thursday, April 2, 2015 at 3:02:31 AM UTC+5:30, Mark Walkom wrote:

> It's not recommended to alter the .in.sh, this file can change between  
> releases and your alterations can either be lost or can cause other  
> problems.
> 
> I'd suggest you do what Gavin mentioned.
> 
> On 1 April 2015 at 18:08, Anil Karaka \<[anilk...@gmail.com](mailto:anilk...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Thanks,
> > 
> > I just kept those GC logging options outside the if block.. So that I  
> > don't have to set that variable, and enabled GC logging by default.
> > 
> > this is in the file /usr/share/elasticsearch/bin/elasticsearch.in.sh
> > 
> > # GC logging options
> > 
> > if ["x$ES\_USE\_GC\_LOGGING" != "x"]; then  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"  
> > fi
> > 
> > # Enable gc logging by default
> > 
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"
> > 
> > On Saturday, March 14, 2015 at 7:18:29 AM UTC+5:30, Gavin Seng wrote:
> > 
> > > Anil, you can try this:
> > > 
> > > # /etc/sysconfig/elasticsearch
> > > 
> > > export ES\_USE\_GC\_LOGGING=1  
> > > ES\_JAVA\_OPTS="-verbose:gc -XX:+PrintGCDateStamps  
> > > -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M  
> > > -Xloggc:"
> > > 
> > > Gavin
> > > 
> > > On Wednesday, March 4, 2015 at 9:22:50 AM UTC-5, Anil Karaka wrote:
> > > 
> > > > Can you please tell me what exactly do I need to add in  
> > > > /etc/default/elasticsearch?
> > > > 
> > > > What should I set ES\_USE\_GC\_LOGGING to?
> > > > 
> > > > I added below line in my dev ES node, and I didn't see the gc.log file  
> > > > in my log folder.. I want to be sure what to do before changing anything in  
> > > > my production cluster..
> > > > 
> > > > ES\_USE\_GC\_LOGGING=true
> > > > 
> > > > And what are the GC logging options in my elasticsearch.yml do? where  
> > > > do those logs appear?
> > > > 
> > > > Thank you.
> > > > 
> > > > On Wednesday, March 4, 2015 at 3:11:26 AM UTC+5:30, Mark Walkom wrote:
> > > > 
> > > > > You can set JAVA\_OPTS in /etc/default/elasticsearch or  
> > > > > /etc/sysconfig/elasticsearch u9nder ES\_JAVA\_OPTS
> > > > > 
> > > > > On 3 March 2015 at 23:11, Anil Karaka [anilk...@gmail.com](mailto:anilk...@gmail.com) wrote:
> > > > > 
> > > > > > Some of the nodes are leaving the cluster from time to time..
> > > > > > 
> > > > > > I un commented the GC Logging options in elasticsearch.yml file as  
> > > > > > shown and restarted my node.
> > > > > > 
> > > > > > ################################## GC Logging  
> > > > > > ################################
> > > > > > 
> > > > > > monitor.jvm.gc.young.warn: 1000ms  
> > > > > > monitor.jvm.gc.young.info: 700ms  
> > > > > > monitor.jvm.gc.young.debug: 400ms
> > > > > > 
> > > > > > monitor.jvm.gc.old.warn: 10s  
> > > > > > monitor.jvm.gc.old.info: 5s  
> > > > > > monitor.jvm.gc.old.debug: 2s
> > > > > > 
> > > > > > yet I'm not able to see any of the GC logging..
> > > > > > 
> > > > > > I came across this blog post [http://tech.taskrabbit.com/](http://tech.taskrabbit.com/)  
> > > > > > blog/2014/07/18/elasticsearch-in-production/
> > > > > > 
> > > > > > `Elasticsearch will note in its normal logs if any GC is happening  
> > > > > > which effects a slow query, but we wanted more detail. Another logging  
> > > > > > option Elasticsearch has is ES\_USE\_GC\_LOGGING which sets some JVM  
> > > > > > variables:
> > > > > > 
> > > > > > # from elasticsearch.in.sh.erbif ["x$ES\_USE\_GC\_LOGGING" != "x"]; then
> > > > > > 
> > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > > > > > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"fi
> > > > > > 
> > > > > > `  
> > > > > > Where do I set the ES\_USE\_GC\_LOGGING option in my node..  
> > > > > > so that I can log GC events..
> > > > > > 
> > > > > > currently there is no gc.log file in my logs folder..  
> > > > > > just normal cluster logs and slow index/search logs..
> > > > > > 
> > > > > > Thanks..
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%  
> > > > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > .  
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google Groups  
> > > > > "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > > > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/22facccb-60fe-4080-87a1-2a5eaa78dd71%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/22facccb-60fe-4080-87a1-2a5eaa78dd71%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 2, 2015, 11:46pm UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/8 "2015-04-02T23:46:12Z")

</div>

We don't recommend G1GC as it can lead to data loss and corruption in the  
underlying lucene engine.

On 2 April 2015 at 16:49, Anil Karaka [anilkaraka@gmail.com](mailto:anilkaraka@gmail.com) wrote:

> Ok, we also had to edit that file to change the default garbage collector  
> options and are now using G1GC. So I thought I will just change the if  
> condition to enable gc logs..
> 
> Any way, this is not the main problem, I'm trying to do all these things  
> to debug the main issue of my nodes leaving the cluster randomly.  
> [Redirecting to Google Groups](https://groups.google.com/forum/#!topic/elasticsearch/E-aGhovVTPI) here  
> are more details. Any help would be appreciated.
> 
> Yesterday night I increased the zen.ping.timeout from 3s to 10s of all my  
> machines and restarted them one by one, and yet to see if its any  
> improvement.  
> Will updating elasticsearch in my nodes fix my issues? Currently my nodes  
> are using ES-1.4.1.
> 
> Thanks.
> 
> On Thursday, April 2, 2015 at 3:02:31 AM UTC+5:30, Mark Walkom wrote:
> 
> > It's not recommended to alter the .in.sh, this file can change between  
> > releases and your alterations can either be lost or can cause other  
> > problems.
> > 
> > I'd suggest you do what Gavin mentioned.
> > 
> > On 1 April 2015 at 18:08, Anil Karaka [anilk...@gmail.com](mailto:anilk...@gmail.com) wrote:
> > 
> > > Thanks,
> > > 
> > > I just kept those GC logging options outside the if block.. So that I  
> > > don't have to set that variable, and enabled GC logging by default.
> > > 
> > > this is in the file /usr/share/elasticsearch/bin/elasticsearch.in.sh
> > > 
> > > # GC logging options
> > > 
> > > if ["x$ES\_USE\_GC\_LOGGING" != "x"]; then  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"  
> > > fi
> > > 
> > > # Enable gc logging by default
> > > 
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"
> > > 
> > > On Saturday, March 14, 2015 at 7:18:29 AM UTC+5:30, Gavin Seng wrote:
> > > 
> > > > Anil, you can try this:
> > > > 
> > > > # /etc/sysconfig/elasticsearch
> > > > 
> > > > export ES\_USE\_GC\_LOGGING=1  
> > > > ES\_JAVA\_OPTS="-verbose:gc -XX:+PrintGCDateStamps  
> > > > -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M  
> > > > -Xloggc:"
> > > > 
> > > > Gavin
> > > > 
> > > > On Wednesday, March 4, 2015 at 9:22:50 AM UTC-5, Anil Karaka wrote:
> > > > 
> > > > > Can you please tell me what exactly do I need to add in  
> > > > > /etc/default/elasticsearch?
> > > > > 
> > > > > What should I set ES\_USE\_GC\_LOGGING to?
> > > > > 
> > > > > I added below line in my dev ES node, and I didn't see the gc.log file  
> > > > > in my log folder.. I want to be sure what to do before changing anything in  
> > > > > my production cluster..
> > > > > 
> > > > > ES\_USE\_GC\_LOGGING=true
> > > > > 
> > > > > And what are the GC logging options in my elasticsearch.yml do? where  
> > > > > do those logs appear?
> > > > > 
> > > > > Thank you.
> > > > > 
> > > > > On Wednesday, March 4, 2015 at 3:11:26 AM UTC+5:30, Mark Walkom wrote:
> > > > > 
> > > > > > You can set JAVA\_OPTS in /etc/default/elasticsearch or  
> > > > > > /etc/sysconfig/elasticsearch u9nder ES\_JAVA\_OPTS
> > > > > > 
> > > > > > On 3 March 2015 at 23:11, Anil Karaka [anilk...@gmail.com](mailto:anilk...@gmail.com) wrote:
> > > > > > 
> > > > > > > Some of the nodes are leaving the cluster from time to time..
> > > > > > > 
> > > > > > > I un commented the GC Logging options in elasticsearch.yml file as  
> > > > > > > shown and restarted my node.
> > > > > > > 
> > > > > > > ################################## GC Logging  
> > > > > > > ################################
> > > > > > > 
> > > > > > > monitor.jvm.gc.young.warn: 1000ms  
> > > > > > > monitor.jvm.gc.young.info: 700ms  
> > > > > > > monitor.jvm.gc.young.debug: 400ms
> > > > > > > 
> > > > > > > monitor.jvm.gc.old.warn: 10s  
> > > > > > > monitor.jvm.gc.old.info: 5s  
> > > > > > > monitor.jvm.gc.old.debug: 2s
> > > > > > > 
> > > > > > > yet I'm not able to see any of the GC logging..
> > > > > > > 
> > > > > > > I came across this blog post [http://tech.taskrabbit.com/blo](http://tech.taskrabbit.com/blo)  
> > > > > > > g/2014/07/18/elasticsearch-in-production/
> > > > > > > 
> > > > > > > `Elasticsearch will note in its normal logs if any GC is happening  
> > > > > > > which effects a slow query, but we wanted more detail. Another logging  
> > > > > > > option Elasticsearch has is ES\_USE\_GC\_LOGGING which sets some JVM  
> > > > > > > variables:
> > > > > > > 
> > > > > > > # from elasticsearch.in.sh.erbif ["x$ES\_USE\_GC\_LOGGING" != "x"]; then
> > > > > > > 
> > > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCDetails"  
> > > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCTimeStamps"  
> > > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintClassHistogram"  
> > > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintTenuringDistribution"  
> > > > > > > JAVA\_OPTS="$JAVA\_OPTS -XX:+PrintGCApplicationStoppedTime"  
> > > > > > > JAVA\_OPTS="$JAVA\_OPTS -Xloggc:/var/log/elasticsearch/gc.log"fi
> > > > > > > 
> > > > > > > `  
> > > > > > > Where do I set the ES\_USE\_GC\_LOGGING option in my node..  
> > > > > > > so that I can log GC events..
> > > > > > > 
> > > > > > > currently there is no gc.log file in my logs folder..  
> > > > > > > just normal cluster logs and slow index/search logs..
> > > > > > > 
> > > > > > > Thanks..
> > > > > > > 
> > > > > > > --  
> > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > > > To view this discussion on the web visit  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b6](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b6)  
> > > > > > > 4-4883-b5d3-bd0f9e1b7312%[40googlegroups.com](http://40googlegroups.com)  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8cc75569-1b64-4883-b5d3-bd0f9e1b7312%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > .  
> > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%  
> > > > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/f807b943-6aad-4923-88db-d02cdb72595f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > .  
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/22facccb-60fe-4080-87a1-2a5eaa78dd71%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/22facccb-60fe-4080-87a1-2a5eaa78dd71%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/22facccb-60fe-4080-87a1-2a5eaa78dd71%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/22facccb-60fe-4080-87a1-2a5eaa78dd71%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-73FAkedn60cfaj2hu5t%2BFF1saJMeqUQ%2B6Owg8TLFNqg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-73FAkedn60cfaj2hu5t%2BFF1saJMeqUQ%2B6Owg8TLFNqg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:21am UTC](https://discuss.elastic.co/t/how-to-enable-garbage-collector-logging-in-an-elastic-search-nodes/22487/9 "2017-07-06T00:21:55Z")

</div>


