gc-logging.asciidoc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. [[gc-logging]]
  2. === GC logging
  3. By default, {es} enables GC logs. These are configured in
  4. <<jvm-options,`jvm.options`>> and output to the same default location as
  5. the {es} logs. The default configuration rotates the logs every 64 MB and
  6. can consume up to 2 GB of disk space.
  7. You can reconfigure JVM logging using the command line options described in
  8. https://openjdk.java.net/jeps/158[JEP 158: Unified JVM Logging]. Unless you
  9. change the default `jvm.options` file directly, the {es} default
  10. configuration is applied in addition to your own settings. To disable the
  11. default configuration, first disable logging by supplying the
  12. `-Xlog:disable` option, then supply your own command line options. This
  13. disables __all__ JVM logging, so be sure to review the available options
  14. and enable everything that you require.
  15. To see further options not contained in the original JEP, see
  16. https://docs.oracle.com/en/java/javase/13/docs/specs/man/java.html#enable-logging-with-the-jvm-unified-logging-framework[Enable
  17. Logging with the JVM Unified Logging Framework].
  18. ==== Examples
  19. * Change the default GC log output location to `/opt/my-app/gc.log` by
  20. creating `$ES_HOME/config/jvm.options.d/gc.options` with some sample
  21. options:
  22. +
  23. [source,shell]
  24. --------------------------------------------
  25. # Turn off all previous logging configuratons
  26. -Xlog:disable
  27. # Default settings from JEP 158, but with `utctime` instead of `uptime` to match the next line
  28. -Xlog:all=warning:stderr:utctime,level,tags
  29. # Enable GC logging to a custom location with a variety of options
  30. -Xlog:gc*,gc+age=trace,safepoint:file=/opt/my-app/gc.log:utctime,pid,tags:filecount=32,filesize=64m
  31. --------------------------------------------
  32. * Configure an {es} <<docker,Docker container>> to send GC debug logs to
  33. standard error (`stderr`). This lets the container orchestrator
  34. handle the output. If using the `ES_JAVA_OPTS` environment variable,
  35. specify:
  36. +
  37. [source,sh]
  38. --------------------------------------------
  39. MY_OPTS="-Xlog:disable -Xlog:all=warning:stderr:utctime,level,tags -Xlog:gc=debug:stderr:utctime"
  40. docker run -e ES_JAVA_OPTS="$MY_OPTS" # etc
  41. --------------------------------------------