Log Monitoring
The Log Monitoring feature of Advanced Monitoring and Alerting monitors slow query logs, slow index logs, access logs, and main logs. This feature helps you obtain real-time cluster log information to quickly troubleshoot and locate issues. This topic describes how to obtain monitoring data and filter log data using Log Monitoring.
Prerequisites
An Alibaba Cloud Elasticsearch instance is created in a region that supports the advanced monitoring and alert service.
The advanced monitoring and alert service is available in the following regions: Hangzhou, Beijing, Shanghai, Shenzhen, Qingdao, Zhangjiakou, Chengdu, Guangzhou, Ulanqab, Beijing Finance Cloud, US (Virginia), US (Silicon Valley), Japan (Tokyo), Indonesia (Jakarta), and China (Hong Kong). The regions available in the console are definitive.
For more information about how to create an instance, see Create an Alibaba Cloud Elasticsearch instance.
Learn how to use Grafana monitoring dashboards. For more information, see Grafana dashboards.
Limits
The advanced monitoring and alert feature provides monitoring and alerts for infrastructure metrics, engine metrics, and log data. Only Elasticsearch 6.7.0 or 7.10.0 with a kernel version later than 1.2.0 supports engine metric monitoring. To upgrade the kernel version, see Upgrade versions.
You cannot access the advanced monitoring and alert service when you use a RAM role for single sign-on (SSO) to the Alibaba Cloud Management Console. For more information, see Log on to the Alibaba Cloud Management Console using a RAM role for SSO. To access the service, use a Resource Access Management (RAM) user for SSO to the Alibaba Cloud Management Console. For more information, see Log on to the Alibaba Cloud Management Console using a RAM user for SSO.
View default log metrics
Log on to the Alibaba Cloud Elasticsearch console.
In the left navigation pane, click Advanced Monitoring Alarms.
Navigate to to view the log monitoring data for all integrated instances.
View monitoring data for a specific instance.
Method 1: Filter by instance ID to view monitoring data
In the monitoring window, click the blank area to the right of the Log Monitoring Dashboard and press the Esc key to open the Grafana menu and the filter bar.
In the filter bar, select instanceId, regionId, and level to view monitoring data for the instance, such as the Redis Slow Log, slow index logs, access logs, and cluster logs.
Method 2: Navigate from the instance list
On the Elasticsearch Instances page, click the ID of the target instance.
In the navigation pane on the left, select .
Click the Infrastructure Monitoring and Advanced Monitoring and Alerts tabs to view the monitoring data for the current instance.
NoteThe Grafana dashboards in the Advanced Monitoring and Alerting service function in the same way as open source Grafana dashboards. For more information, see the Grafana documentation.
The default monitoring dashboards provided by the Advanced Monitoring and Alerting service cannot be modified. To create a dashboard that better suits your business needs, you can configure a custom monitoring dashboard.
Query logs
Log Monitoring supports filtered queries for slow query logs, slow index logs, access logs, and main logs. Different log types are retrieved from different data sources, as shown in the following table.
Data Source |
Description |
es-slow-search |
Provides slow search log data. |
es-slow-index |
Provides slow index log data. |
es-access-log |
Provides access log data (available only for version 6.7.0 and 7.10.0 instances). |
es-instance-search |
Provides main log data. |
The procedure for querying different types of logs is the same. The following steps use a slow query log as an example.
Log on to the Alibaba Cloud Elasticsearch console.
In the navigation pane on the left, click Advanced Monitoring Alarms.
Select .
On the Log Monitoring page, click the Slow Query Log tab.
Specify the Query.
For example, to retrieve slow query logs from an instance whose ID starts with `es-cn-n6w24ma4`, for the `geonames` index, with content that includes `aggregations`, and a query time of 240 ms or less, use the following query statement:
instanceId:es-cn-n6w24ma4* AND index_name: geonames AND content: aggregations AND search_time_ms: <=240NoteA Query can include operators such as
>,<,=,>=,<=,AND, andOR. For more information, see Query string.Different log types use different data sources, and the available query fields vary by data source. For example, on the slow query log page,
es-slow-searchis the slow query data source, andsearch_time_msis a field that represents the query time. For more information, see Built-in fields for log queries.On the Log Monitoring page, the only available feature is Query, which can only be used to retrieve log data. Other search settings cannot be modified. For example, you cannot change the search scope from the default value of logs to sum or another value.
View the logs that match the query.
The available data sources and query fields vary by log type. For example, only the slow query data source provides the search_time_ms field. This field is not available in the slow index data source. For more information, see Built-in log query fields.
Built-in fields for log queries
Independent field
Type
Independent field
Note
Slow query
search_time_ms
Query duration.
search_total_hits
The number of documents that the query hit.
search_type
shard_id
The ID of the shard that executed the query.
slow_search_log_type
total_shards
Total number of shards.
Content
The query body.
Slow write
index_time_ms
Write duration.
content
The query body.
Main log
Content
The query body.
Access log
node
The Elasticsearch node that generates the access log.
query
The query body to execute. For filtering, use the source field instead of the `query` field.
remote
The IP address of the remote server.
bodySize
Request size. Unit: bytes.
uri
Access path.
NoteThe unique fields table lists only the fields that are specific to each log type. For fields that are common to all log types, see the following common fields table.
Common fields
By field
Note
es_available_zone
The zone of the instance.
es_region
The region where the instance is located.
es_resourceUid
The UID of the instance.
es_resource_group
The resource group that contains the instance.
host
The IP address of the node.
instanceId
Instance ID.
Level
The log level, including trace, debug, info, warn, or error.
NoteFields that start with
_are part of the Elasticsearch metadata.