Alibaba Cloud Elasticsearch provides the logs of your Elasticsearch cluster. You can view the logs on the Logs page of the Elasticsearch console. This page contains the following tabs: Cluster Log, Search Slow Log, Indexing Slow Log, GC Log, Access Log, and Asynchronous Write Log. You can enter a keyword and specify a time range to search for specific log entries. This topic describes how to query logs and configure slow logs.
Background information
You can query log entries from a maximum of seven consecutive days. By default, the log entries are displayed by time in descending order. The Lucene query syntax is supported. For more information, see Query string syntax.
- Alibaba Cloud Elasticsearch can return a maximum of 10,000 log entries for each query. If the returned log entries do not contain the expected log data, you can specify a time range when you query the log data.
- The Access Log tab is displayed only for Elasticsearch V6.7.0 clusters of the Standard Edition that use the latest kernel. For more information how to update a kernel, see Upgrade the version of a cluster.
Procedure
The following example demonstrates how to search for the log entries of an Elasticsearch
cluster. The log entries meet the following conditions: the content
field contains the health
keyword, the level
field is info
, and the host
field is 172.16.xx.xx
.
Configure slow logs
PUT _settings
{
"index.indexing.slowlog.threshold.index.debug" : "10ms",
"index.indexing.slowlog.threshold.index.info" : "50ms",
"index.indexing.slowlog.threshold.index.warn" : "100ms",
"index.search.slowlog.threshold.fetch.debug" : "100ms",
"index.search.slowlog.threshold.fetch.info" : "200ms",
"index.search.slowlog.threshold.fetch.warn" : "500ms",
"index.search.slowlog.threshold.query.debug" : "100ms",
"index.search.slowlog.threshold.query.info" : "200ms",
"index.search.slowlog.threshold.query.warn" : "1s"
}
After the configuration is completed, if the time to run a read or write task is exceeded, you can query the related logs on the Logs page of your cluster.