How to change slow log settings in Elasticsearch
What are the slow log settings in Elasticsearch?
Elasticsearch provide facility to keep track of your slow queries while indexing and searching data. It helps us to identify the slow elasticsearch query. You can configure slow log threshold according to your requirement. Its just depends on your architecture. Sometimes 2s query are fine for us but sometime we need result within 2ms :). You can slow log threshold in your elasticsearch.yml.
Type of slow logs:
Search Slow Settings:
By default search slow log settings are disable. We can configure these settings for Query and Fetch separately.
You need copy these settings in your elasticsearch configuration file (elasticsearch.yml)
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
Indexing Slow Log Settings:
Indexing slow log are the similar to the search slow log. Indexing slow log keep track of all the indexing query which are hitting while indexing data into the Elasticsearch. To enable indexing slow log copy these settings in elasticsearch.yml and restart the elasticsearch.
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
Reference:
https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-slowlog.html