slowlog.asciidoc 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. [[index-modules-slowlog]]
  2. == Slow Log
  3. [float]
  4. [[search-slow-log]]
  5. === Search Slow Log
  6. Shard level slow search log allows to log slow search (query and fetch
  7. phases) into a dedicated log file.
  8. Thresholds can be set for both the query phase of the execution, and
  9. fetch phase, here is a sample:
  10. [source,yaml]
  11. --------------------------------------------------
  12. index.search.slowlog.threshold.query.warn: 10s
  13. index.search.slowlog.threshold.query.info: 5s
  14. index.search.slowlog.threshold.query.debug: 2s
  15. index.search.slowlog.threshold.query.trace: 500ms
  16. index.search.slowlog.threshold.fetch.warn: 1s
  17. index.search.slowlog.threshold.fetch.info: 800ms
  18. index.search.slowlog.threshold.fetch.debug: 500ms
  19. index.search.slowlog.threshold.fetch.trace: 200ms
  20. --------------------------------------------------
  21. All of the above settings are _dynamic_ and can be set per-index.
  22. By default, none are enabled (set to `-1`). Levels (`warn`, `info`,
  23. `debug`, `trace`) allow to control under which logging level the log
  24. will be logged. Not all are required to be configured (for example, only
  25. `warn` threshold can be set). The benefit of several levels is the
  26. ability to quickly "grep" for specific thresholds breached.
  27. The logging is done on the shard level scope, meaning the execution of a
  28. search request within a specific shard. It does not encompass the whole
  29. search request, which can be broadcast to several shards in order to
  30. execute. Some of the benefits of shard level logging is the association
  31. of the actual execution on the specific machine, compared with request
  32. level.
  33. The logging file is configured by default using the following
  34. configuration (found in `logging.yml`):
  35. [source,yaml]
  36. --------------------------------------------------
  37. index_search_slow_log_file:
  38. type: dailyRollingFile
  39. file: ${path.logs}/${cluster.name}_index_search_slowlog.log
  40. datePattern: "'.'yyyy-MM-dd"
  41. layout:
  42. type: pattern
  43. conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
  44. --------------------------------------------------
  45. [float]
  46. [[index-slow-log]]
  47. === Index Slow log
  48. The indexing slow log, similar in functionality to the search slow
  49. log. The log file is ends with `_index_indexing_slowlog.log`. Log and
  50. the thresholds are configured in the elasticsearch.yml file in the same
  51. way as the search slowlog. Index slowlog sample:
  52. [source,yaml]
  53. --------------------------------------------------
  54. index.indexing.slowlog.threshold.index.warn: 10s
  55. index.indexing.slowlog.threshold.index.info: 5s
  56. index.indexing.slowlog.threshold.index.debug: 2s
  57. index.indexing.slowlog.threshold.index.trace: 500ms
  58. index.indexing.slowlog.level: info
  59. index.indexing.slowlog.source: 1000
  60. --------------------------------------------------
  61. All of the above settings are _dynamic_ and can be set per-index.
  62. By default Elasticsearch will log the first 1000 characters of the _source in
  63. the slowlog. You can change that with `index.indexing.slowlog.source`. Setting
  64. it to `false` or `0` will skip logging the source entirely an setting it to
  65. `true` will log the entire source regardless of size.
  66. The index slow log file is configured by default in the `logging.yml`
  67. file:
  68. [source,yaml]
  69. --------------------------------------------------
  70. index_indexing_slow_log_file:
  71. type: dailyRollingFile
  72. file: ${path.logs}/${cluster.name}_index_indexing_slowlog.log
  73. datePattern: "'.'yyyy-MM-dd"
  74. layout:
  75. type: pattern
  76. conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
  77. --------------------------------------------------