All Products
Search
Document Center

ApsaraDB for MongoDB:DescribeRunningLogRecords

Last Updated:Jan 17, 2023

Queries entries in operational 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.

Authorization information

The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:

  • 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 keyword: refers to the condition keyword defined by the cloud product itself.
  • 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.
Operate access level Resource type conditional keyword Association operation
dds:DescribeRunningLogRecords READ
  • MongoDB
    acs:dds:{#regionId}:{#accountId}:dbinstance/{#dbinstanceId}
    without
without

Request parameters

Parameter Type Required Description Example
DBInstanceId string Yes

The ID of the instance.

Note If you set this parameter to the ID of a sharded cluster instance, you must also specify the NodeId parameter.
dds-bpxxxxxxxx
NodeId string No

The ID of the mongos node or shard node whose operational logs you want to query in the instance. If the instance is a sharded cluster instance, you must specify this parameter.

Note This parameter is valid only when DBInstanceId is set to the ID of a sharded cluster instance.
d-bpxxxxxxxx
StartTime string Yes

The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

2019-01-01T12:10Z
EndTime string Yes

The end of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

Note The end time must be later than the start time and within 24 hours from the start time. Otherwise, the query fails.
2019-01-01T13:10Z
DBName string No

The name of the database.

mongodbtest
RoleType string No

The role of the node whose error logs you want to query in the instance. Valid values:

  • primary
  • secondary
Note If you set the NodeId parameter to the ID of a mongos node, the RoleType parameter must be set to primary.
primary
PageSize integer No

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

30
PageNumber integer No

The number of the page to return. The value must be an integer that is greater than 0. Default value: 1.

1
OrderType string No

The order of time in which the operational 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
ResourceGroupId string No

The ID of the resource group.

sg-bpxxxxxxxxxxxxxxxxxx
RoleId string No

The role ID of the node. You can call the DescribeReplicaSetRole operation to query the role ID.

651xxxxx

Response parameters

Parameter Type Description Example
object
TotalRecordCount integer

The total number of entries.

2
PageRecordCount integer

The number of entries returned per page.

30
RequestId string

The ID of the request.

45D2B592-DEBA-4347-BBF3-47FF6C97DBBC
PageNumber integer

The number of the page to return.

1
Items array

Details about the operational log entries.

object
ConnInfo string

The connection information of the log entry.

conn18xxxxxx
CreateTime string

The time when the log entry was generated. The time is in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

2019-02-26T12:09:34Z
Category string

The category of the log entry. Valid values:

NETWORK
Content string

The content of the log entry.

end connection 11.xxx.xxx.xx:3xxxx (0 connections now open)\n
Engine string

The database engine.

MongoDB

Example

Normal return example

JSONFormat

{
  "TotalRecordCount": 2,
  "PageRecordCount": 30,
  "RequestId": "45D2B592-DEBA-4347-BBF3-47FF6C97DBBC",
  "PageNumber": 1,
  "Items": {
    "LogRecords": [
      {
        "ConnInfo": "conn18xxxxxx",
        "CreateTime": "2019-02-26T12:09:34Z",
        "Category": "NETWORK",
        "Content": " end connection 11.xxx.xxx.xx:3xxxx (0 connections now open)\\n"
      }
    ]
  },
  "Engine": "MongoDB"
}

Error codes

Http code Error code Error message
400 InvalidParameterCombination The end time must be greater than the start 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.

For a list of error codes, visit the API error center.