Queries the error logs of an ApsaraDB for MongoDB instance.

  • This operation is supported by replica set instances and sharded cluster instances. This operation is not supported by standalone instances.
  • You can call this operation up to 30 times per minute. If you want to call this operation more than 30 times per minute, 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. 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 to DescribeErrorLogRecords.

RegionId String No cn-hangzhou

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

DBInstanceId String Yes dds-bpxxxxxxxx

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.
NodeId String No d-bpxxxxxxxx

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

Note This parameter takes effect only when you set the DBInstanceId parameter to the ID of a sharded cluster instance.
RoleType String No primary

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 value of the RoleType parameter must be primary.
StartTime String Yes 2019-01-01T12:10Z

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.

EndTime String Yes 2019-01-02T12:10Z

The end of the time range to query. The end time must be later than the start time. The interval between the start time and the end time must be less than or equal to one day. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

DBName String No mongodbtest

The name of the database whose error logs you want to query in the instance.

PageSize Integer No 30

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

PageNumber Integer No 1

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

ResourceGroupId String No sg-bpxxxxxxxxxxxxxxxxxx

The ID of the resource group to which the instance belongs.

Response parameters

Parameter Type Example Description
TotalRecordCount Integer 1

The total number of entries returned.

PageRecordCount Integer 1

The number of entries returned per page.

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

The ID of the request.

PageNumber Integer 1

The number of the page returned.

Items Array of LogRecords

An array that consists of the details about the error logs returned.

ConnInfo String conn18xxxxxx

The connection information of the log entry.

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

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

Category String NETWORK

The category of the log entry. Valid values: Return value:

  • NETWORK: network connection log
  • ACCESS: access control log
  • -: general log
  • COMMAND: slow query log
  • SHARDING: sharded cluster log
  • STORAGE: storage engine log
  • CONNPOOL: connection pool log
  • ASIO: asynchronous I/O operation log
  • WRITE: slow update log
Content String xxxxxxxx

The content of the log entry.

Id Integer 1111111111

The ID of the log entry.

Engine String MongoDB

The database engine that is recorded in the log entry.

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 parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<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

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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.