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

Querying Database Error Logs

Description

This API is used to query database error logs.

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

Restrictions

A maximum of 2000 records can be queried within the period specified by start_date and end_date.

URI

  • URI format

    GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/errorlog?start_date={start_date}&end_date={end_date}

  • URI example
    • Querying database error logs

      https://dds.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/6ade8143870047b8999aba8f1891b48ein02/errorlog?start_date=2018-08-06T10:41:14+0800&end_date=2018-08-07T10:41:14+0800

    • Querying database error logs based on specified conditions.

      https://dds.ap-southeast-1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/6ade8143870047b8999aba8f1891b48ein02/errorlog?type=WARNING&offset=1&limit=20&node_id=a7c84462483642798cf159237343135fno06&start_date=2018-08-06T10:41:14+0800&end_date=2018-08-07T10:41:14+0800

Table 1 Parameter description

Name

Type

Mandatory

Description

X-Auth-Token

String

Yes

User token obtained from IAM. For details, see Authentication.

Content-Type

String

Yes

MIME type of the request body. You are advised to use the default value application/json. For APIs used to upload objects or images, the value can vary depending on the flow type.

project_id

String

Yes

Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

instance_id

String

Yes

The instance ID, which can be obtained by calling the API for querying instances. If you do not have an instance, you can call the API used for creating an instance.

start_date

String

Yes

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

CAUTION:

The start time is 31 days earlier than the current time.

end_date

String

Yes

The 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.
  • Only error logs generated within the last month can be queried.
NOTE:

The end time cannot be later than the current time.

node_id

String

No

The node ID. For details, see Table 8.

If this parameter is left blank, all nodes in the instance can be queried.

Nodes that can be queried:

  • mongos, shard, and config nodes in a cluster instance.
  • All nodes in a replica set or single node instance.

type

String

No

The statement type. If it is left blank, all statement types are queried. Valid value:

  • WARNING
  • ERROR

offset

Integer

No

The index position. Its value range is [0, 1999].

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

Integer

No

The number of resources to be queried. The value ranges from 1 to 100. The default value is 10, indicating that 10 records are returned by default.

NOTE:

The sum of limit and offset values must be less than or equal to 2000.

Requests

None

Responses

  • Parameter description
    Table 2 Parameter description

    Name

    Type

    Description

    error_log_list

    Array of objects

    The detailed information.

    For details, see Table 3.

    total_record

    Integer

    The total number of records.

    Table 3 error_log_list field data structure description

    Name

    Type

    Description

    node_name

    String

    The node name.

    level

    String

    The log level.

    time

    String

    The time in the UTC format.

    content

    String

    The log content.

  • Response example
    {
      "error_log_list": [
        {
          "node_name": "Test_replica_node_2",
          "level": "WARNING",
          "time": "2020-12-15T08:53:01.868+0000",
          "content": "W NETWORK  [LogicalSessionCacheReap] Unable to reach primary for set replica"
        }
      ],
      "total_record": 1
    }

SDK

Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.