You can call this operation to query the error logs of the MongoDB instance.

This operation is applicable to replica set instances and sharded cluster instances. DescribeErrorLogRecords cannot be performed on standalone instances.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeErrorLogRecords

The operation that you want to perform. Set the value toDescribeErrorLogRecords.

StartTime String Yes 2019-01-01T12:10Z

The beginning of the time range to query. The time is in the format of yyyy-MM-dd T HH:mm z(UTC time).

End time String Yes 2019-01-02T12:10Z

The end of the time range that you want to query. The time is in the yyyy-MM-dd T HH:mm Z format.

DBInstanceId String Yes dds-bpxxxxxxxx

The ID of the instance.

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

The ID of the mongos or shard in the specified sharded cluster instance.

Note This parameter is only valid when you specify theDBInstanceIdparameter to the ID of a sharded cluster instance.
RoleType String No primary

The role of the node in the instance. Default value: LooseDispersion. Valid values:

  • primary
  • secondary
Note If you set NodeId to the ID of a mongos, the value of this parameter can only be primary.
DBName String No mongodbtest

The name of the database.

PageSize Integer No 300

The number of records to display on each page. Valid values: 30 to 100.

PageNumber Integer No 1

The number of the page. Valid values: any non-zero positive Integer. Default value:1.

RegionId String No cn-hangzhou

The region ID of the instance. You can call the DescribeDBInstanceAttribute operation to query the region ID of the instance.

Response parameters

Prameter Type Sample response Description
Items Array

A list of error log details.

LogRecords
Category String NETWORK

The category of the log.

ConnInfo String conn18xxxxxx

The log connection information.

Content String xxxxxxxx

The content of log information.

CreateTime String 2019-02-26T12:09:34Z

Log generation time, in the format of yyyy-MM-dd T HH:mm:ss z(UTC time).

PageNumber Integer 1

The page number of the returned page.

PageRecordCount Integer 1

The number of records per page.

RequestId String 68BCBEC2-1E66-471F-A1A8-E3C60C0A80B0

The ID of the request.

TotalRecordCount Integer 1

The total number of records.

Examples

Sample requests

http(s)://mongodb.aliyuncs.com/? Action=DescribeErrorLogRecords
&StartTime=2019-01-01T12:10Z
&EndTime=2019-01-02T12:10Z
&DBInstanceId=dds-bpxxxxxxxx
&<Common request parameter>

Sample success response

XML format

<DescribeErrorLogRecordsResponse>
      <Items>
            <LogRecords>
                  <Category>NETWORK</Category>
                  <CreateTime>2019-02-26T12:09:34Z</CreateTime>
                  <ConnInfo>conn18xxxxxx</ConnInfo>
                  <Content>xxxxxxxx</Content>
            </LogRecords>
      </Items>
      <PageNumber>1</PageNumber>
      <TotalRecordCount>2</TotalRecordCount>
      <RequestId>68BCBEC2-1E66-471F-A1A8-E3C60C0A80B0</RequestId>
</DescribeErrorLogRecordsResponse>

JSON format

{
    "Items": {
        "LogRecords": [
            {
                "Category": "NETWORK",
                "CreateTime": "2019-02-26T12:09:34Z",
                "ConnInfo": "conn18xxxxxx",
                "Content": "xxxxxxxx"
            }
        ]
    },
    "PageNumber": 1,
    "TotalRecordCount": 2,
    "RequestId": "68BCBEC2-1E66-471F-A1A8-E3C60C0A80B0"
}

Error codes.

For a list of error codes, visit the API Error Center.