Best way to enable GC logging (as of 2.x)


(Bruno Lavoie) #1

Hello,

I looked at many sources for enabling GC logging, so much confusion.

What is the best way to enable this?

  • In elasticsearch.yml file via monitor.jvm.* values?
  • In /etc/sysconfig/elasticsearch ES_JAVA_OPTS? What to put there?

Is it a good thing to always enable this, even if we're not currently under memory pressure ?
Just to be cautious.

If enabled, how to keep just a certain amount of log files?

Thanks
Bruno Lavoie


(Bruno Lavoie) #2

Anyone?
I just want to do it, the right way. :slight_smile:


(Boaz Leskes) #3

What are you trying to achieve exactly? if you want ES log when a GC took longer than X time, and you are note happy with the default, you can put the following in your elasticsearch.yml file (the numbers here show the default values)

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

(Bruno Lavoie) #4

First of all, thanks for replying.

Ok, so I saw these default values in pre-2.x config files.

Just putting these lines will activate slow GCs?
Or is it already activated by default with these values and will be logged?
GC info logged in which file?
Should I turn some other flags, like putting something in ES_JAVA_OPTS?

I just want to be ready in case of slow GC and have all necessary information necessary at hand.

Thanks


(Boaz Leskes) #5

These are the defaults and they are already active. The output is logged in the same log file as the rest of the log output. Typically in logs/CLUSTERNAME.log


(system) #6