You can call the DescribeSQLLogReports operation to query the SQL log reports of an ApsaraDB RDS instance.
This operation is deprecated. We recommend that you call the DescribeSQLLogReportList operation to query the SQL log reports of an ApsaraDB RDS instance.
You can query the SQL log reports that are generated within a specific time frame, for example, from 02:00:00 to 03:00:00.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeSQLLogReports |
The operation that you want to perform. Set the value to DescribeSQLLogReports. |
DBInstanceId | String | Yes | rm-uf6wjk5xxxxxxx |
The ID of the instance. You can call the DescribeDBInstances operation to query the IDs of instances. |
EndTime | String | Yes | 2021-03-18T16:00:00Z |
The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. Note The end time must be later than the start time.
|
StartTime | String | Yes | 2021-03-13T16:00:00Z |
The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. |
PageSize | Integer | No | 30 |
The number of entries to return on each page. Valid values:
Default value: 30. |
PageNumber | Integer | No | 1 |
The number of the page to return. Valid values: any non-zero positive integer. Default value: 1. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Items | Array of Item |
An array that consists of SQL log reports. |
|
Item | |||
LatencyTopNItems | Array of LatencyTopNItem |
An array that consists of SQL statements executed with the highest latency. |
|
LatencyTopNItem | |||
AvgLatency | Long | 500 |
The average time that is required to execute the SQL statement. Unit: milliseconds. |
SQLExecuteTimes | Long | 5 |
The number of times that the SQL statement is executed. |
SQLText | String | SELECT * FROM table_name; |
The SQL statement returned. Note Only the first 128 characters of the SQL statement are returned. In addition, only
the SQL statements that take more than 100 ms to execute are returned.
|
QPSTopNItems | Array of QPSTopNItem |
An array that consists of SQL statements executed the most frequently. |
|
QPSTopNItem | |||
SQLExecuteTimes | Long | 5 |
The number of times that the SQL statement is executed. |
SQLText | String | SELECT * FROM table_name; |
The SQL statement returned. Note Only the first 128 characters of the SQL statement are returned. In addition, only
the SQL statements that take more than 5 ms to execute are returned.
|
ReportTime | String | 2019-03-27T16:00:00Z |
The time when the report was generated. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC. |
PageNumber | Integer | 1 |
The page number of the returned page. |
PageRecordCount | Integer | 30 |
The number of reports on the current page. |
RequestId | String | 08A3B71B-FE08-4B03-974F-CC7EA6DB1828 |
The ID of the request. |
TotalRecordCount | Integer | 60 |
The total number of records returned. |
Examples
Sample requests
http(s)://rds.aliyuncs.com/?Action=DescribeSQLLogReports
&DBInstanceId=rm-uf6wjk5xxxxxxx
&EndTime=2021-03-18T16:00:00Z
&StartTime=2021-03-13T16:00:00Z
&<Common request parameters>
Sample success responses
XML
format
<DescribeSQLLogReportsResponse>
<TotalRecordCount>60</TotalRecordCount>
<PageRecordCount>30</PageRecordCount>
<RequestId>08A3B71B-FE08-4B03-974F-CC7EA6DB1828 </RequestId>
<PageNumber>1</PageNumber>
<Items>
<Item>
<ReportTime>2019-03-27T16:00:00Z</ReportTime>
<LatencyTopNItems>
<LatencyTopNItem>
<AvgLatency>500</AvgLatency>
<SQLExecuteTimes>5</SQLExecuteTimes>
<SQLText>SELECT * FROM table_name;</SQLText>
</LatencyTopNItem>
</LatencyTopNItems>
<QPSTopNItems>
<QPSTopNItem>
<SQLExecuteTimes>5</SQLExecuteTimes>
<SQLText>SELECT * FROM table_name;</SQLText>
</QPSTopNItem>
</QPSTopNItems>
</Item>
</Items>
</DescribeSQLLogReportsResponse>
JSON
format
{
"TotalRecordCount": "60",
"PageRecordCount": "30",
"RequestId": "08A3B71B-FE08-4B03-974F-CC7EA6DB1828\t",
"PageNumber": "1",
"Items": {
"Item": [{
"ReportTime": "2019-03-27T16:00:00Z",
"LatencyTopNItems": {
"LatencyTopNItem": [{
"AvgLatency": "500",
"SQLExecuteTimes": "5",
"SQLText": "SELECT * FROM table_name;"
}]
},
"QPSTopNItems": {
"QPSTopNItem": [{
"SQLExecuteTimes": "5",
"SQLText": "SELECT * FROM table_name;"
}]
}
}]
}
}
Error codes
For a list of error codes, visit the API Error Center.