Updated on 2025-08-20 GMT+08:00

Querying Database Error Logs (MySQL)

Function

This API is used to query the latest error logs of a DB instance. A maximum of 2,000 log records can be queried.

Constraints

This API is supported for MySQL only.

URI

  • URI format

    GET /v3.1/{project_id}/instances/{instance_id}/errorlog?start_date={start_date}&end_date={end_date}

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Definition

    Project ID of a tenant in a region.

    To obtain the value, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    instance_id

    Yes

    Definition

    ID of the instance to be queried.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    start_date

    Yes

    Definition

    Start time.

    Constraints

    N/A

    Range

    The value is 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.

    Default Value

    N/A

    end_date

    Yes

    Definition

    End time.

    Constraints

    You can only query error logs generated within a month.

    Range

    The value is 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.

    Default Value

    N/A

    offset

    No

    Definition

    Index offset. The query starts from the next piece of data indexed by this parameter.

    Constraints

    N/A

    Range

    The value must be a non-negative number.

    Default Value

    0: The query starts from the first data record.

    limit

    No

    Definition

    Number of records (query results) displayed on each page.

    Constraints

    N/A

    Range

    1–100

    Default Value

    10

    level

    No

    Definition

    Log level.

    Constraints

    N/A

    Range

    • ALL
    • INFO
    • LOG
    • WARNING
    • ERROR
    • FATAL
    • PANIC
    • NOTE

    Default Value

    ALL

Request

  • Request parameters

    None

  • URI example

    GET https://{endpoint}/v3.1/0483b6b16e954cb88930a360d2c4e663/instances/cee5265e1e5845649e354841234567dfin01/errorlog?offset=1&limit=10&start_date=2022-08-23T07:41:50+0800&end_date=2022-08-24T07:41:50+0800&level=ALL

Response

  • Normal response
    Table 2 Parameters

    Parameter

    Type

    Description

    error_log_list

    Array of objects

    Definition

    Detailed information.

    For details, see Table 3.

    total_record

    Integer

    Definition

    Total number of records.

    Range

    N/A

    Table 3 error_log_list field data structure description

    Parameter

    Type

    Description

    time

    String

    Definition

    Time in the UTC format.

    Range

    N/A

    level

    String

    Definition

    Log level.

    Range

    N/A

    content

    String

    Definition

    Error log content.

    Range

    N/A

  • Example normal response
    {
      "error_log_list": [
        {
          "time": "2022-08-23T22:59:17Z",
          "level": "WARNING",
          "content": "Occur error when reading bytes from a network handler. Client actively closes the connection."
        },
        {
          "time": "2022-08-23T22:54:17Z",
          "level": "WARNING",
          "content": "Occur error when reading bytes from a network handler. Client actively closes the connection."
        }
      ],
      "total_record": 2
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.