diff --git a/bin/logstash.lib.sh b/bin/logstash.lib.sh index a5d6ccee3..b1e86e065 100755 --- a/bin/logstash.lib.sh +++ b/bin/logstash.lib.sh @@ -35,6 +35,11 @@ setup_java() { JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75" JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly" + # Causes the JVM to dump its heap on OutOfMemory. + JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError" + # The path to the heap dump location, note directory must exists and have enough + # space for a full heap dump. + JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=${LOGSTASH_HOME}/heapdump.hprof" fi if [ "$LS_JAVA_OPTS" ] ; then