All Products
Search
Document Center

ApsaraDB for MongoDB:DescribeSlowLogRecords

Last Updated:Sep 03, 2024

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.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
dds:DescribeSlowLogRecordsget
  • Instance
    acs:dds:{#regionId}:{#accountId}:dbinstance/{#dbinstanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBInstanceIdstringYes

The instance ID.

Note If you set this parameter to the ID of a sharded cluster instance, you must also specify the NodeId parameter.
dds-bp1fc7e65108****
NodeIdstringNo

The ID of the shard node.

Note This parameter is required only when you specify the DBInstanceId parameter to the ID of a sharded cluster instance.
d-bp18b06ebc21****
StartTimestringYes

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
EndTimestringYes

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
  • The end time must be later than the start time.

  • The end time must be within 24 hours from the start time. Otherwise, the query fails.

2021-08-16T14:13Z
DBNamestringNo

The name of the database.

mongodbtest
QueryKeywordsstringNo

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
LogicalOperatorstringNo

The logical relationship among multiple keywords.

  • or
  • and (default value)
and
PageSizeintegerNo

The number of entries to return on each page. Valid values: 30 to 100.

30
PageNumberintegerNo

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
OrderTypestringNo

The order of time in which the log entries to return are sorted. Valid values:

  • asc: The log entries are sorted by time in ascending order.
  • desc: The log entries are sorted by time in descending order.
asc
ResourceGroupIdstringNo

The ID of the resource group to which the instances you want to query belong.

rg-acfmyiu4ekp****

Response parameters

ParameterTypeDescriptionExample
object
TotalRecordCountinteger

The total number of returned entries.

1
PageRecordCountinteger

The number of slow query log entries returned on the page.

1
RequestIdstring

The request ID.

8076C4BA-DDBD-529C-BFF4-D8620C3F****
PageNumberinteger

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
Itemsarray<object>

An array that consists of the information about each slow query.

object
ExecutionStartTimestring

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
HostAddressstring

The host IP address that is used to connect to the database.

192.168.XX.XX
QueryTimesstring

The execution time of the statement. Unit: milliseconds.

600
TableNamestring

The name of the collection.

C1
SQLTextstring

The SQL statement that is executed during the slow operation.

{\"op\":\"query\",\"ns\":\"mongodbtest.customer\",\"query\":{\"find\":\"customer\",\"filter\":{\"name\":\"jack\"}}}
ReturnRowCountslong

The number of rows returned by the SQL statement.

0
KeysExaminedlong

The number of rows involved in index scans.

0
DBNamestring

The name of the database.

mongodbtest
DocsExaminedlong

The number of documents that are scanned during the operation.

1000000
AccountNamestring

The username of the database account that performs the operation.

test
Enginestring

The database engine.

MongoDB

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError messageDescription
400IncorrectCharacterTypeCurrent DB instance CharacterType does not support this operation.-
400InvalidParameterCombinationThe end time must be greater than the start timeThe start time must be earlier than the end time.
400InvalidStartTime.MalformedThe Specified parameter StartTime is not valid.-
400InvalidEndTime.MalformedThe Specified parameter EndTime is not valid.-
403LogApiFrequencyExceededExceeding the allowed frequency of log api.Maximum number of log API operations exceeded.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-22The Error code has changed. The request parameters of the API has changedView Change Details