Queries the error log details of an instance within a specified time range.
Operation description
Queries the error log details of an instance within a specified time range.
Before you begin, make sure the following prerequisites are met:
The target database engine is one of the following: ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, PolarDB for MySQL, PolarDB for PostgreSQL, PolarDB for PostgreSQL (Compatible with Oracle), or ApsaraDB for MongoDB.
If you use the SDK of Alibaba Cloud or DAS, use the latest version.
When you call DAS by using the SDK, set the region to cn-shanghai.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:DescribeErrorLogRecords |
none |
*All Resource
|
None | None |
Request syntax
POST HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The instance ID. |
pc-bp1u5mas9exx7**** |
| NodeId |
string |
No |
The node ID. |
pi-bp16v3824rt73**** |
| Role |
string |
No |
The node role. Valid values:
Note
Only ApsaraDB for MongoDB instances are supported. |
db |
| StartTime |
integer |
Yes |
The start time of the query. The value is in the format of a UNIX timestamp, in milliseconds. Important The data type of this parameter is Long. During the sequence of serialization/deserialization, precision loss may occur. Ensure that the value does not exceed 9007199254740991. |
1731983066000 |
| EndTime |
integer |
Yes |
The end time of the query. The value is in the format of a UNIX timestamp, in milliseconds. Important The data type of this parameter is Long. During the sequence of serialization/deserialization, precision loss may occur. Ensure that the value does not exceed 9007199254740991. |
1732069466000 |
| PageNumber |
integer |
No |
The page number. |
1 |
| PageSize |
integer |
No |
The number of entries per page. Maximum value: 100. |
10 |
| Filters |
array<object> |
No |
The filter conditions. Note
Only error log filtering for ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, PolarDB for MySQL, PolarDB for PostgreSQL, and PolarDB for PostgreSQL (Compatible with Oracle) is supported. |
|
|
object |
No |
The filter condition. |
||
| Key |
string |
No |
The filter parameter. Set this parameter to filters. |
filters |
| Value |
string |
No |
The error log content to filter. |
deadlock |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| Code |
integer |
The returned status code. |
200 |
| Data |
object |
The data details. |
|
| EndTime |
string |
The end time of the query. The time is in the yyyy-MM-ddTHH:mm:ssZ format (UTC). |
2025-07-23T05:48:43Z |
| ItemsNumbers |
integer |
The total number of log entries returned. |
10 |
| Logs |
array<object> |
The log details. |
|
|
object |
The log details. |
||
| Category |
string |
The log category. Valid values:
Note
Only ApsaraDB for MongoDB instances are supported. |
NETWORK |
| ConnInfo |
string |
The log connection information. Note
Only ApsaraDB for MongoDB instances are supported. |
conn18xxxxxx |
| Content |
string |
The error log content. |
2025-07-15T15:14:27.175188+08:00 0 [Note] [MY-012468] [InnoDB] Transactions deadlock detected, dumping detailed information. |
| CreateTime |
string |
The time when the error log was generated. The value is a UNIX timestamp in milliseconds. Important For ApsaraDB for MongoDB instances, the time is in the yyyy-MM-ddTHH:mm:ssZ format (UTC). |
1731983067000 |
| DBInstanceName |
string |
The node ID. Note
Only ApsaraDB for MongoDB instances are supported. |
d-bp128a003436**** |
| Db |
string |
The database name. Note
Only certain special logs of ApsaraDB RDS for PostgreSQL and PolarDB for PostgreSQL instances are supported. |
db_name |
| User |
string |
The database account. Note
Only certain special logs of ApsaraDB RDS for PostgreSQL and PolarDB for PostgreSQL instances are supported. |
db_user |
| UserIp |
string |
The client IP address. Note
Only certain special logs of ApsaraDB RDS for PostgreSQL and PolarDB for PostgreSQL instances are supported. |
x.x.x.x |
| MaxRecordsPerPage |
integer |
The maximum number of records per page. |
10 |
| PageNumbers |
integer |
The page number of the current query. |
1 |
| StartTime |
string |
The start time of the query. The time is in the yyyy-MM-ddTHH:mm:ssZ format (UTC). |
2025-07-22T05:48:43Z |
| TotalRecords |
integer |
The total number of log entries within the query time range. |
100 |
| Message |
string |
The returned message. Note
If the request is successful, Successful is returned. If the request fails, an error message that contains information such as an error code is returned. |
Successful |
| RequestId |
string |
The request ID. |
AAA17591-B48B-4D31-9CD6-9B9796B2**** |
| Success |
boolean |
Indicates whether the request is successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"Code": 200,
"Data": {
"EndTime": "2025-07-23T05:48:43Z",
"ItemsNumbers": 10,
"Logs": [
{
"Category": "NETWORK",
"ConnInfo": "conn18xxxxxx",
"Content": "2025-07-15T15:14:27.175188+08:00 0 [Note] [MY-012468] [InnoDB] Transactions deadlock detected, dumping detailed information.",
"CreateTime": "1731983067000",
"DBInstanceName": "d-bp128a003436****\n",
"Db": "db_name",
"User": "db_user",
"UserIp": "x.x.x.x"
}
],
"MaxRecordsPerPage": 10,
"PageNumbers": 1,
"StartTime": "2025-07-22T05:48:43Z",
"TotalRecords": 100
},
"Message": "Successful",
"RequestId": "AAA17591-B48B-4D31-9CD6-9B9796B2****",
"Success": true
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | The request parameters are invalid. |
| 403 | NoPermission | You are not authorized to do this action. | You do not have the permission to perform this operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.