Slow log settings
The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Stack
Generally available
Elastic Cloud Serverless projects restrict the available Elasticsearch settings to a supported subset, identified with a Serverless badge next to the setting name. For a complete list of available index settings, refer to the Serverless index settings list.
Elasticsearch query logging provides a unified alternative to slow logs for search operations. Query logging captures the end-to-end request duration as measured by Elasticsearch, while slow logs only capture shard-level execution time. Query logging also covers all query types (Query DSL, ES|QL, EQL, and SQL) with a single configuration. We recommend migrating search-related slow log usage to query logging. Slow logs remain the only option for indexing operations.
The slow log in Elasticsearch helps you capture search or indexing operations that exceed certain durations, which can be useful when diagnosing slow performance or indexing bottlenecks. For more information about slow log formats and how to enable slow logs, refer to Slow query and index logging.
Slow logs are emitted under fileset.name = "slowlog", logger names index.search.slowlog or index.indexing.slowlog.
By default, all thresholds default to -1, which disables slow logging.
Search slow logs emit per shard. They must be enabled separately for the shard’s query and fetch search phases.
index.search.slowlog.threshold.query.<level>-
Sets the minimum threshold for logging slow query-phase operations.
<level>can bewarn,info,debug, andtrace. The threshold value accepts a string format that specifies a number and a unit of measurement such asms,s, or any other accepted increments. When a query takes longer than the configured value, a slow log entry is emitted.Example
The following request enables slow logs by configuring thresholds:
JSON PUT /my-index-000001/_settings{ "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.<level>-
Sets the minimum threshold for logging slow fetch-phase operations (retrieving documents after query hits).
<level>can bewarn,info,debug, andtrace. The threshold value accepts a string format that specifies a number and a unit of measurement such asms,s, or any other accepted increments. When fetching takes longer than the configured value, a slow log entry is emitted.Example
The following request enables slow logs by configuring thresholds:
JSON PUT /my-index-000001/_settings{ "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" } index.search.slowlog.include.user-
This setting accepts a boolean value. If set to
true, it includesuser.*andauth.typemetadata in the log entries. These fields contain information about the user who triggered the request.Example
The following request enables slow logs and includes information about who triggered the request:
JSON PUT /my-index-000001/_settings{ "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", "index.search.slowlog.include.user": true }
Indexing slow logs emit per index document.
index.indexing.slowlog.threshold.index.<level>-
Sets the minimum threshold for logging slow indexing operations.
<level>can bewarn,info,debug, andtrace. The threshold value accepts a string format that specifies a number and a unit of measurement such asms,s, or any other accepted increments. When an indexing operation takes longer than the configured value, a slow log entry is emitted.Example
The following request enables slow logs by configuring thresholds:
JSON PUT /my-index-000001/_settings{ "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" } index.indexing.slowlog.include.user-
This setting accepts a boolean value. If set to
true, it includesuser.*andauth.typemetadata in the log entries. These fields contain information about the user who initiated the request.Example
The following request enables slow logs by configuring thresholds and includes information about who triggered the request:
JSON PUT /my-index-000001/_settings{ "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", "index.indexing.slowlog.include.user": true } index.indexing.slowlog.source-
Sets the number of
_sourcecharacters to include. By default, Elasticsearch logs the first 1000 characters in the slow log. Set tofalseor0to disable source logging. Set totrueto log the entire source regardless of size.Example
The following request enables slow logs by configuring thresholds and setting the number of
_sourcecharacters to include to 3000, rather than the default of 1000:JSON PUT /my-index-000001/_settings{ "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", "index.indexing.slowlog.include.user": true, "index.indexing.slowlog.source": "3000" } index.indexing.slowlog.reformat-
This setting accepts a boolean value. It's set to
trueby default and reformats the original_sourceinto a single-line log entry. If you want to preserve the original document format, then you can turn off reformatting by setting it tofalse. This causes source to be logged with the original formatting intact, potentially spanning multiple log lines.Example
The following request enables slow logs by configuring thresholds and includes reformatting the
_sourceinto a single-line entry:JSON PUT /my-index-000001/_settings{ "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", "index.indexing.slowlog.include.user": true, "index.indexing.slowlog.source": "3000", "index.indexing.slowlog.reformat": true }