Updated on 2025-12-09 GMT+08:00

Obtaining the Audit Log List

Function

This API is used to obtain an audit log list.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dds:instance:listAuditLog

    list

    instance

    g:EnterpriseProjectId

    dds:instance:list

    -

URI

  • URI format

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

  • URI example

    https://dds.ap-southeast-1.myhuaweicloud.com/v3/056538411200d4cd2f79c003c7606412/instances/65d3fe0c50984b35bc1a36e9b7c7de98in02/auditlog?start_time=2020-12-06T09:00:00+0800&end_time=2020-12-10T18:00:15+0800&offset=0&limit=33

Table 1 Path parameters

Name

Mandatory

Type

Description

project_id

Yes

String

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Query parameters

Name

Mandatory

Type

Description

node_id

No

String

Definition

ID of the node whose audit logs are to be queried. If this parameter is not transferred, the audit logs of all nodes are queried by default. The audit logs of cluster instances are distributed on mongos nodes.

Constraints

N/A

Range

N/A

Default Value

N/A

start_time

Yes

String

Definition

Query start time.

Constraints

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.

Range

N/A

Default Value

N/A

end_time

Yes

String

Definition

Query end time.

Constraints

The value is in the "yyyy-mm-ddThh:mm:ssZ" format. The end time must be later than the start time and the time span cannot be longer than 30 days.

T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.

Range

N/A

Default Value

N/A

offset

No

Integer

Definition

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

Constraints

The value cannot be a negative number.

Range

N/A

Default Value

The default value is 0, indicating that the query starts from the first data record.

limit

No

Integer

Definition

Number of records to be queried.

Constraints

1 to 100

Range

N/A

Default Value

The default value is 100, indicating that the first 100 instances are queried.

Request Parameters

Table 3 Request header parameters

Name

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Language.

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Table 4 Response body parameters

Name

Type

Description

audit_logs

Array of objects

Definition

The audit log details. For details about audit logs, see Table 5.

Range

N/A

total_record

Integer

Definition

The total number of records.

Range

N/A

total_size

Long

Definition

Total size of audit logs used by the current instance, in bytes.

Range

N/A

Table 5 audit_logs description

Name

Type

Description

node_id

String

Definition

The node ID.

Range

N/A

id

String

Definition

The audit log ID.

Range

N/A

name

String

Definition

The audit log file name.

Range

N/A

size

Long

Definition

The size of the audit log in byte.

Range

N/A

start_time

String

Definition

The start time of the audit log. The format is "yyyy-mm-ddThh:mm:ssZ".

T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.

Range

N/A

end_time

String

Definition

The end time of the audit log. The format is "yyyy-mm-ddThh:mm:ssZ".

T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.

Range

N/A

Example Requests

GET 
https://{endpoint}/v3/056538411200d4cd2f79c003c7606412/instances/65d3fe0c50984b35bc1a36e9b7c7de98in02/auditlog?start_time=2020-12-06T09:00:00+0800&end_time=2020-12-10T18:00:15+0800&offset=0&limit=33

Example Responses

{    
  "total_record" : 1,    
  "audit_logs" : [ {      
    "id" : "10190012aae94b38a10269b8ad025fc1no02_1607681849871",    
    "name" : "0a84b6e97780d3271fd0c00f2db42932_audit_log_65d3fe0c50984b35bc1a36e9b7c7de98in02_10190012aae94b38a10269b8ad025fc1no02_1607681849871",   
    "size" : "2473",    
    "node_id" : "10190012aae94b38a10269b8ad025fc1no02",   
    "start_time" : "2020-12-11T18:14:49+0800",    
    "end_time" : "2020-12-11T18:17:25+0800"   
 } ]  
}

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.