Updated on 2024-04-01 GMT+08:00

Querying Database Error Logs

Function

This API is used to query database error logs. Before calling this API:

This API will be unavailable on March 31, 2025. You are advised to switch workloads to the new API (Querying Error Logs) before then.

URI

GET /v3/{project_id}/instances/{instance_id}/errorlog

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

start_date

Yes

String

Start time in the "yyyy-mm-ddThh:mm:ssZ" format.

T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, in the Beijing time zone, the time zone offset is shown as +0800.

end_date

Yes

String

End time in the "yyyy-mm-ddThh:mm:ssZ" format.

T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, in the Beijing time zone, the time zone offset is shown as +0800.

Only error logs generated within the last month can be queried.

offset

No

Integer

Index offset. If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value cannot be a negative number.

limit

No

Integer

Number of records to be queried. The default value is 100. The value must be a positive integer. The minimum value is 1 and the maximum value is 100.

level

No

String

Log level. The default value is ALL. Valid value:

  • ALL
  • INFO
  • WARNING
  • ERROR
  • FATAL
  • NOTE

node_id

Yes

String

Node ID.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token.

X-Language

No

String

Language.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

error_log_list

Array of MysqlErrorLogList objects

Error log details.

total_record

Integer

Total number of records.

Table 5 MysqlErrorLogList

Parameter

Type

Description

node_id

String

Node ID.

time

String

Time in the UTC format.

level

String

Log level.

  • ALL
  • INFO
  • WARNING
  • ERROR
  • FATAL
  • NOTE

content

String

Error log content.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/096c0fc43e804757b59946b80dc27f8bin07/errorlog?offset=0&limit=1&level=ALL&start_date=2022-07-10T00:00:00+0800&end_date=2022-07-19T00:00:00+0800&node_id=cc07c60e94ec4575989840e648fb4f66no07

Example Response

Status code: 200

Success.

{
  "error_log_list" : [ {
    "node_id" : "cc07c60e94ec4575989840e648fb4f66no07",
    "time" : "2022-07-17T07:34:33",
    "level" : "ERROR",
    "content" : "[MY013508] [Repl] do failed: 1"
  } ]
}

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.