Collector "Alibaba Cloud - PolarDB Slow Query Logs" 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 PolarDB instance object collection. If the custom object collection for PolarDB is not configured, the slow log script will not be able to collect slow log data.
1. Configuration Structure¶
The configuration structure of this collector is as follows:
Field | Type | Required | Description |
---|---|---|---|
regions |
list | Required | List of regions to collect data from |
regions[#] |
str | Required | Region ID. Example: 'cn-hangzhou' See appendix for full list |
2. Configuration Example¶
Specifying a Region¶
Collect data from the Hangzhou region.
3. Data Reporting Format¶
After data is successfully synchronized, you can view the data in the "Logs" section of TrueWatch.
An example of the reported data is as follows:
{
"measurement": "aliyun_polardb_slowlog",
"tags": {
"DBName" : "PolarDB_MySQL",
"DBNodeId": "pi-***************"
},
"fields": {
"CreateTime" : "2023-05-22Z",
"MaxExecutionTime" : 60,
"MaxLockTime" : 1,
"ParseMaxRowCount" : 1,
"ParseTotalRowCounts" : 2,
"ReturnMaxRowCount" : 3,
"ReturnTotalRowCounts": 1,
"SQLHASH" : "U2FsdGVkxxxx",
"SQLText" : "select id,name from tb_table",
"TotalExecutionCounts": 2,
"TotalExecutionTimes" : 2,
"TotalLockTimes" : 1,
"message" : "{Log JSON data}"
}
}
Some parameter descriptions are as follows:
Field | Type | Description |
---|---|---|
MaxExecutionTime |
Long | Maximum execution time, in seconds |
TotalExecutionTimes |
Long | Total execution time, in seconds |
TotalLockTimes |
Long | Total lock time, in seconds |
MaxLockTime |
Long | Maximum lock time, in seconds |
ReturnMaxRowCount |
Long | Maximum number of SQL rows returned |
ReturnTotalRowCounts |
Long | Total number of SQL rows returned |
ParseMaxRowCount |
Long | Maximum number of SQL rows parsed |
ParseTotalRowCounts |
Long | Total number of SQL rows parsed |
TotalExecutionCounts |
Long | Total number of executions |
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: