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

Obtaining Audit Logs

Function

This API is used to obtain audit logs.

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

rds:auditlog:list

read

instance

g:EnterpriseProjectId

g:ResourceTag/<tag-key>

-

-

URI

  • URI format

    GET /v3/{project_id}/instances/{instance_id}/auditlog?start_time={start_time}&end_time={end_time}&offset={offset}&limit={limit}

  • 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_time

    Yes

    Definition

    Query 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_time

    Yes

    Definition

    Query end time.

    Constraints

    N/A

    Range

    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. For example, in the Beijing time zone, the time zone offset is shown as +0800.

    Default Value

    N/A

    offset

    Yes

    Definition

    Index offset. If offset is set to N, the query starts from the N+1 piece of data. The value 0 indicates that the query starts from the first piece of data.

    Constraints

    The value must be a non-negative number.

    Range

    An integer greater than or equal to 0

    Default Value

    0

    limit

    Yes

    Definition

    Number of records to be queried.

    Constraints

    N/A

    Range

    [1, 50]

    Default Value

    N/A

Request

  • Request parameters

    None

  • URI example

    GET https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/cee5265e1e5845649e354841234567dfin01/auditlog?start_time=2019-11-06T09:00:00+0800&end_time=2019-11-07T10:40:15+0800&offset=0&limit=10

Response

  • Normal response
    Table 2 Parameters

    Parameter

    Type

    Description

    auditlogs

    Array of objects

    Definition

    Indicates detailed information.

    For details, see Table 3.

    total_record

    Integer

    Definition

    Indicates the total number of records.

    Range

    N/A

    Table 3 auditlogs field data structure description

    Parameter

    Type

    Description

    id

    String

    Definition

    Indicates the audit log ID. For the SQL Server engine, the ID is the audit log file name.

    Range

    N/A

    name

    String

    Definition

    Indicates the audit log file name.

    Range

    N/A

    size

    double

    Definition

    Indicates the size in KB of the audit log.

    Range

    N/A

    begin_time

    String

    Definition

    Indicates the start time of the audit log.

    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.

    end_time

    String

    Definition

    Indicates the end time of the audit log.

    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.

  • Example normal response
    {
    	"auditlogs": [{
    		"id": "fa163ea0e2bet11e9d832166a2cf894c5br01",
    		"name": "2943db4292ee4d4abb1ae2df4870fedf_528f6b03c71c4d559ca4f60b6e20795fin01/39779175_20220825/Audit/317156_20190916032844_eb8fe5d181ec44a2850302691541f760in01_Audit_166a2cf8-d832-11e9-94c5-fa163ea0e2be",
    		"size": 20481.835938,
    		"begin_time": "2019-11-06T09:03:34+0800",
    		"end_time": "2019-11-06T10:39:15+0800"
    	}, {
    		"id": "fa163ea0e2bet11e9d832136a668094c5br01",
    		"name": "2943db4292ee4d4abb1ae2df4870fedf_528f6b03c71c4d559ca4f60b6e20795fin01/39779175_20220825/Audit/317162_20190916032838_eb8fe5d181ec44a2850302691541f760in01_Audit_136a6680-d832-11e9-94c5-fa163ea0e2be",
    		"size": 20481.835938,
    		"begin_time": "2019-11-07T09:04:35+0800",
    		"end_time":"2019-11-07T10:38:16+0800"
    	}],
    	"total_record": 2
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.