Help Center/ GeminiDB/ API Reference/ APIs v3 (Recommended)/ Logs/ Querying Database Error Logs
Updated on 2024-08-08 GMT+08:00

Querying Database Error Logs

Function

This API is used to query error logs of an instance. Searching for error logs by keyword is not supported.

Constraints

This API supports GeminiDB Mongo instances.

The latest 2,000 error logs can be queried.

The past one month of error logs can be queried.

URI

GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/error-log

Table 1 Path 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, which can be obtained by calling the API described in Querying Instances and Details. If there are no instances available, call the API described in Creating an Instance to create one.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

start_time

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.

The start time is at most 30 days earlier than the current time.

end_time

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.

Only error logs generated in the past month can be queried.

The end time cannot be later than the current time.

node_id

No

String

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

type

No

String

Statement type. If this parameter is left empty, all statement types are queried. The following log types are supported:

  • Warning
  • Error

offset

No

Integer

Index offset.

  • Its value ranges from 0 to 1999. If offset is set to N, the resource query starts from the N+1 piece of data. If action is set to filter, offset is 0 by default, indicating that the query starts from the first piece of data.
  • The value must be a positive integer.

limit

No

Integer

Number of records to be queried.

  • The value ranges from 1 to 100. The default value is 10, indicating that 10 records are returned by default.
  • The sum of limit and offset values must be less than or equal to 2000.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Response Parameters

Status code: 202

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of records.

error_log_list

Array of Table 5 objects

Error log information.

Table 5 ErrorLogList

Parameter

Type

Description

node_name

String

Node name.

level

String

Log level.

time

String

UTC time when logs are generated.

content

String

Log content.

Example Requests

  • URI example
    GET https://gaussdb-nosql.ap-southeast-1.myhuaweicloud.com/v3/375d8d8fad1f43039e23d3b6c0f60a19/instances/9136fd2a9fcd405ea4674276ce36dae8in10/error-log
  • Example request body

    None

Example Responses

Status code: 202

Success

{ 
  "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_count" : 1 
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.