Queries the details of entries in slow query logs of an ApsaraDB for MongoDB instance.
Operation description
This operation is applicable only to general-purpose local-disk and dedicated local-disk instances.
You can call this operation up to 30 times per minute. To call this operation at a higher frequency, use a Logstore. For more information, see Manage a Logstore.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dds:DescribeSlowLogRecords |
get |
*Instance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DBInstanceId |
string |
Yes |
The instance ID. Note
If you set this parameter to the ID of a sharded cluster instance, you must also specify the |
dds-bp1fc7e65108**** |
| NodeId |
string |
No |
The ID of the shard node. Note
This parameter is required only when you specify the |
d-bp18b06ebc21**** |
| StartTime |
string |
Yes |
The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC. |
2021-08-15T14:13Z |
| EndTime |
string |
Yes |
The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC. Note
|
2021-08-16T14:13Z |
| DBName |
string |
No |
The name of the database. |
mongodbtest |
| QueryKeywords |
string |
No |
The keywords used for query. You can enter up to 10 keywords at a time. If you enter multiple keywords, separate the keywords with spaces. |
test test1 |
| LogicalOperator |
string |
No |
The logical relationship among multiple keywords.
|
and |
| PageSize |
integer |
No |
The number of entries to return on each page. Valid values: 30 to 100. |
30 |
| PageNumber |
integer |
No |
The page number of the page to return. The value must be a positive integer that does not exceed the maximum value of the INTEGER data type. Default value: 1. |
1 |
| OrderType |
string |
No |
The order of time in which the log entries to return are sorted. Valid values:
|
asc |
| ResourceGroupId |
string |
No |
The ID of the resource group to which the instances you want to query belong. |
rg-acfmyiu4ekp**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| TotalRecordCount |
integer |
The total number of returned entries. |
1 |
| PageRecordCount |
integer |
The number of slow query log entries returned on the page. |
1 |
| RequestId |
string |
The request ID. |
8076C4BA-DDBD-529C-BFF4-D8620C3F**** |
| PageNumber |
integer |
The page number of the returned page. The value is a positive integer that does not exceed the maximum value of the INTEGER data type. Default value: 1. |
1 |
| Items |
object |
||
| LogRecords |
array<object> |
An array that consists of the information about each slow query. |
|
|
object |
|||
| ExecutionStartTime |
string |
The start time of the operation. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC. |
2019-02-25T 01:41:28Z |
| HostAddress |
string |
The host IP address that is used to connect to the database. |
192.168.XX.XX |
| QueryTimes |
string |
The execution time of the statement. Unit: milliseconds. |
600 |
| TableName |
string |
The name of the collection. |
C1 |
| SQLText |
string |
The SQL statement that is executed during the slow operation. |
{\"op\":\"query\",\"ns\":\"mongodbtest.customer\",\"query\":{\"find\":\"customer\",\"filter\":{\"name\":\"jack\"}}} |
| ReturnRowCounts |
integer |
The number of rows returned by the SQL statement. |
0 |
| KeysExamined |
integer |
The number of rows involved in index scans. |
0 |
| DBName |
string |
The name of the database. |
mongodbtest |
| DocsExamined |
integer |
The number of documents that are scanned during the operation. |
1000000 |
| AccountName |
string |
The username of the database account that performs the operation. |
test |
| Engine |
string |
The database engine. |
MongoDB |
Examples
Success response
JSON format
{
"TotalRecordCount": 1,
"PageRecordCount": 1,
"RequestId": "8076C4BA-DDBD-529C-BFF4-D8620C3F****",
"PageNumber": 1,
"Items": {
"LogRecords": [
{
"ExecutionStartTime": "2019-02-25T 01:41:28Z",
"HostAddress": "192.168.XX.XX",
"QueryTimes": "600",
"TableName": "C1",
"SQLText": "{\\\"op\\\":\\\"query\\\",\\\"ns\\\":\\\"mongodbtest.customer\\\",\\\"query\\\":{\\\"find\\\":\\\"customer\\\",\\\"filter\\\":{\\\"name\\\":\\\"jack\\\"}}}",
"ReturnRowCounts": 0,
"KeysExamined": 0,
"DBName": "mongodbtest",
"DocsExamined": 1000000,
"AccountName": "test"
}
]
},
"Engine": "MongoDB"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IncorrectCharacterType | Current DB instance CharacterType does not support this operation. | |
| 400 | InvalidParameterCombination | The end time must be greater than the start time | The start time must be earlier than the end time. |
| 400 | InvalidStartTime.Malformed | The Specified parameter StartTime is not valid. | |
| 400 | InvalidEndTime.Malformed | The Specified parameter EndTime is not valid. | |
| 403 | LogApiFrequencyExceeded | Exceeding the allowed frequency of log api. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.