2013-08-28 19:24:34 -04:00
|
|
|
[[index-modules-slowlog]]
|
2015-06-22 17:49:45 -04:00
|
|
|
== Slow Log
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
[float]
|
2013-09-25 12:17:40 -04:00
|
|
|
[[search-slow-log]]
|
2013-08-28 19:24:34 -04:00
|
|
|
=== Search Slow Log
|
|
|
|
|
|
|
|
Shard level slow search log allows to log slow search (query and fetch
|
2015-06-22 17:49:45 -04:00
|
|
|
phases) into a dedicated log file.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
Thresholds can be set for both the query phase of the execution, and
|
|
|
|
fetch phase, here is a sample:
|
|
|
|
|
2015-06-22 17:49:45 -04:00
|
|
|
[source,yaml]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2015-06-22 17:49:45 -04:00
|
|
|
index.search.slowlog.threshold.query.warn: 10s
|
|
|
|
index.search.slowlog.threshold.query.info: 5s
|
|
|
|
index.search.slowlog.threshold.query.debug: 2s
|
|
|
|
index.search.slowlog.threshold.query.trace: 500ms
|
|
|
|
|
|
|
|
index.search.slowlog.threshold.fetch.warn: 1s
|
|
|
|
index.search.slowlog.threshold.fetch.info: 800ms
|
|
|
|
index.search.slowlog.threshold.fetch.debug: 500ms
|
|
|
|
index.search.slowlog.threshold.fetch.trace: 200ms
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-06-22 17:49:45 -04:00
|
|
|
All of the above settings are _dynamic_ and can be set per-index.
|
|
|
|
|
2013-08-28 19:24:34 -04:00
|
|
|
By default, none are enabled (set to `-1`). Levels (`warn`, `info`,
|
|
|
|
`debug`, `trace`) allow to control under which logging level the log
|
|
|
|
will be logged. Not all are required to be configured (for example, only
|
|
|
|
`warn` threshold can be set). The benefit of several levels is the
|
|
|
|
ability to quickly "grep" for specific thresholds breached.
|
|
|
|
|
|
|
|
The logging is done on the shard level scope, meaning the execution of a
|
|
|
|
search request within a specific shard. It does not encompass the whole
|
|
|
|
search request, which can be broadcast to several shards in order to
|
|
|
|
execute. Some of the benefits of shard level logging is the association
|
|
|
|
of the actual execution on the specific machine, compared with request
|
|
|
|
level.
|
|
|
|
|
|
|
|
The logging file is configured by default using the following
|
|
|
|
configuration (found in `logging.yml`):
|
|
|
|
|
2015-06-22 17:49:45 -04:00
|
|
|
[source,yaml]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
index_search_slow_log_file:
|
|
|
|
type: dailyRollingFile
|
|
|
|
file: ${path.logs}/${cluster.name}_index_search_slowlog.log
|
|
|
|
datePattern: "'.'yyyy-MM-dd"
|
|
|
|
layout:
|
|
|
|
type: pattern
|
|
|
|
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
[float]
|
2013-09-25 12:17:40 -04:00
|
|
|
[[index-slow-log]]
|
2013-08-28 19:24:34 -04:00
|
|
|
=== Index Slow log
|
|
|
|
|
2014-04-15 00:55:39 -04:00
|
|
|
The indexing slow log, similar in functionality to the search slow
|
2013-08-28 19:24:34 -04:00
|
|
|
log. The log file is ends with `_index_indexing_slowlog.log`. Log and
|
|
|
|
the thresholds are configured in the elasticsearch.yml file in the same
|
|
|
|
way as the search slowlog. Index slowlog sample:
|
|
|
|
|
2015-06-22 17:49:45 -04:00
|
|
|
[source,yaml]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2015-06-22 17:49:45 -04:00
|
|
|
index.indexing.slowlog.threshold.index.warn: 10s
|
|
|
|
index.indexing.slowlog.threshold.index.info: 5s
|
|
|
|
index.indexing.slowlog.threshold.index.debug: 2s
|
|
|
|
index.indexing.slowlog.threshold.index.trace: 500ms
|
2015-08-11 16:13:43 -04:00
|
|
|
index.indexing.slowlog.level: info
|
|
|
|
index.indexing.slowlog.source: 1000
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-06-22 17:49:45 -04:00
|
|
|
All of the above settings are _dynamic_ and can be set per-index.
|
|
|
|
|
2015-08-11 16:13:43 -04:00
|
|
|
By default Elasticsearch will log the first 1000 characters of the _source in
|
|
|
|
the slowlog. You can change that with `index.indexing.slowlog.source`. Setting
|
|
|
|
it to `false` or `0` will skip logging the source entirely an setting it to
|
|
|
|
`true` will log the entire source regardless of size.
|
|
|
|
|
2013-08-28 19:24:34 -04:00
|
|
|
The index slow log file is configured by default in the `logging.yml`
|
|
|
|
file:
|
|
|
|
|
2015-06-22 17:49:45 -04:00
|
|
|
[source,yaml]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
index_indexing_slow_log_file:
|
|
|
|
type: dailyRollingFile
|
|
|
|
file: ${path.logs}/${cluster.name}_index_indexing_slowlog.log
|
|
|
|
datePattern: "'.'yyyy-MM-dd"
|
|
|
|
layout:
|
|
|
|
type: pattern
|
|
|
|
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
|
|
|
|
--------------------------------------------------
|