Collector "Alibaba Cloud-RDS Slow Query Statistics Log" Configuration Manual¶
Before reading this document, please read:
Tip
Before using this collector, you must install the "Integration Core Package" and its accompanying third-party dependencies.
Tip
The code execution of this script depends on the RDS instance object collection. If the custom object collection for RDS is not configured, the slow log script will not be able to collect slow log data.
Tip
Due to a 6~8 hour delay in Alibaba Cloud statistical data returns, the collector data update may be delayed. For details, refer to the Alibaba Cloud documentation: Alibaba Cloud RDS Query Slow Log Statistics.
Tip
This collector supports all versions of MySQL (except MySQL 5.7 Basic Edition), SQL Server 2008 R2, and MariaDB 10.3 databases. To collect other types of databases, please use the Alibaba Cloud-RDS Slow Query Details collector.
1. Configuration Structure¶
The configuration structure of this collector is as follows:
Field | Type | Required | Description |
---|---|---|---|
regions |
list | Required | List of regions to be collected |
regions[#] |
str | Required | Region ID. E.g., 'cn-hangzhou' See appendix for full list |
2. Configuration Example¶
Specified Region¶
Collect data from Hangzhou and Shanghai regions.
3. Data Reporting Format¶
After data is successfully synchronized, you can view the data in the "Logs" section of TrueWatch.
Example of reported data:
{
"measurement": "aliyun_rds_slowlog",
"tags": {
"name" : "rm-xxxxx",
"DBName" : "cloudcare_core",
"DBInstanceId" : "rm-bp1xxxxxxxxxx",
"RegionId" : "cn-hangzhou",
"DBInstanceType" : "Primary",
"PayType" : "Prepaid",
"Engine" : "MySQL",
"DBInstanceClass" : "rds.mysql.s2.large",
"ZoneId" : "cn-shanghai-h",
"DBInstanceDescription": "Business System"
},
"fields": {
"SQLHASH" : "436f9dd030e0a87920bbcd818b34f271",
"SQLText" : "{SQL Statement}",
"CreateTime" : "2022-06-05Z",
"SQLServerTotalExecutionTimes" : 0,
"MaxExecutionTime" : 1,
"MaxLockTime" : 0,
"AvgExecutionTime" : 0,
"MySQLTotalExecutionTimes" : 0,
"SQLServerTotalExecutionTimes" : 1,
"SQLServerTotalExecutionCounts": 0,
"MySQLTotalExecutionCounts" : 0,
"SQLServerAvgExecutionTime" : 0,
"message" : "{Log JSON Data}"
}
}
Partial parameter descriptions:
Field | Type | Description |
---|---|---|
SQLServerTotalExecutionTimes |
int | SQL Server execution duration (total, milliseconds) |
AvgExecutionTime |
int | Execution time (average) unit: seconds |
SQLServerAvgExecutionTime |
int | Execution time (average) unit: seconds |
MySQLTotalExecutionTimes |
int | MySQL execution time (total) unit: seconds |
SQLServerTotalExecutionTimes |
int | SQL Server execution time (total) unit: milliseconds |
SQLServerTotalExecutionCounts |
int | SQL Server execution count (total) |
MySQLTotalExecutionCounts |
int | MySQL execution count (total) |
Note
Fields such as AvgExecutionTime, SQLServerAvgExecutionTime, SQLServerTotalExecutionTimes, etc., are only supported by SQL Server instances.
Note
The fields in tags and fields may change with subsequent updates.
Tip
fields.message is a JSON serialized string.
X. Appendix¶
Please refer to the official Alibaba Cloud documentation: