Queries slow query logs generated within a specified time range for a Tair (Redis OSS-compatible) instance.
Operation description
You can also query slow logs in the Tair (Redis OSS-compatible) console. For more information, see Query slow logs of an instance. You can call this operation up to 100 times per minute.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
kvstore:DescribeSlowLogRecords |
get |
*DBInstance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The ID of the instance. |
r-bp1zxszhcgatnx**** |
| NodeId |
string |
No |
The ID of a node in the instance. Specify this parameter to query slow logs for a specific node. Note
This parameter is available only for read/write splitting instances and cluster instances. |
r-bp1zxszhcgatnx****-db-0 |
| StartTime |
string |
Yes |
The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format (ISO 8601). The time must be in UTC. |
2019-03-10T14:00Z |
| EndTime |
string |
Yes |
The end of the time range to query. Must be later than the start time. The time range cannot exceed one day. A range of 1 hour is recommended. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC. |
2019-03-10T15:00Z |
| DBName |
string |
No |
The name of the database. |
0 |
| PageSize |
integer |
No |
The number of entries to return on each page. Valid values: 30, 50, and 100. Default value: 30. |
30 |
| PageNumber |
integer |
No |
The page number to return. Must be an integer greater than 0. Default value: 1. |
1 |
| SlowLogRecordType |
string |
No |
The type of slow logs to query. Default value: db. Valid values:
|
proxy |
| QueryKeyword |
string |
No |
The keyword used to filter slow logs. |
keyword1 |
| OrderType |
string |
No |
The sort order of the results. Default value: DESC. Valid values:
|
ASC |
| OrderBy |
string |
No |
The field by which to sort the results. Default value: execution_time. Valid values:
|
execution_time |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| StartTime |
string |
The start time of the query. |
2019-03-10T14:00Z |
| RequestId |
string |
The ID of the request. |
686BB8A6-BBA5-47E5-8A75-D2ADE433**** |
| PageRecordCount |
integer |
The number of log entries returned on the current page. |
1 |
| TotalRecordCount |
integer |
The total number of returned log entries. |
1 |
| PageSize |
integer |
The maximum number of log entries returned per page. |
30 |
| InstanceId |
string |
The ID of the instance. |
r-bp10n******** |
| Engine |
string |
The database engine of the instance. |
Redis |
| PageNumber |
integer |
The page number. |
1 |
| Items |
object |
||
| LogRecords |
array<object> |
The slow query log entries. |
|
|
object |
|||
| Account |
string |
The ID of the account. |
0 |
| ElapsedTime |
integer |
The execution time of the slow query. Unit: microseconds. |
248 |
| Command |
string |
The slow query statement. |
KEYS * |
| DBName |
string |
The database name. |
0 |
| ExecuteTime |
string |
The time when the slow query was executed, in the YYYY-MM-DDTHH:mm:ssZ format. |
2019-03-12T09:18:41Z |
| DataBaseName |
string |
The database name. This parameter has the same purpose as DBName. We recommend that you use DBName instead. |
0 |
| NodeId |
string |
The node ID. |
r-bp1zxszhcgatnx****-db-0 |
| AccountName |
string |
The account username. |
demo |
| IPAddress |
string |
The IP address of the client. |
172.16.88.*** |
Examples
Success response
JSON format
{
"StartTime": "2019-03-10T14:00Z",
"RequestId": "686BB8A6-BBA5-47E5-8A75-D2ADE433****",
"PageRecordCount": 1,
"TotalRecordCount": 1,
"PageSize": 30,
"InstanceId": "r-bp10n********",
"Engine": "Redis",
"PageNumber": 1,
"Items": {
"LogRecords": [
{
"Account": "0",
"ElapsedTime": 248,
"Command": "KEYS *",
"DBName": "0",
"ExecuteTime": "2019-03-12T09:18:41Z",
"DataBaseName": "0",
"NodeId": "r-bp1zxszhcgatnx****-db-0",
"AccountName": "demo",
"IPAddress": "172.16.88.***"
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidStartTime.Malformed | The Specified parameter StartTime is not valid. | |
| 400 | InvalidEndTime.Malformed | The Specified parameter EndTime is not valid. | |
| 403 | IncorrectEngineVersion | Current engine version does not support operations. | |
| 403 | ServerBusy | server busy now, please retry later. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.