Updated on 2025-06-19 GMT+08:00

Querying User Operation Logs

Function

This API is used to query the operation logs.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/{instance_id}/dbss/audit/operate-log

Table 1 URI parameter

Parameter

Mandatory

Parameter Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

Instance ID. You can obtain the value from the ID field in the API for querying the instance list.

Request Parameter

Table 2 Request header parameter

Parameter

Mandatory

Parameter Type

Description

X-Auth-Token

Yes

String

User token. The token can be queried by calling the IAM API. (The token is the value of X-Subject-Token in the response header.)

Table 3 Request body parameter

Parameter

Mandatory

Type

Description

time

No

TimeRangeBean object

Query time range

user_name

No

String

Operation log username

action

No

String

Action

  • CREATE
  • DELETE
  • DOWNLOAD
  • UPDATE

result

No

String

Execution result

  • success
  • fail

page

No

String

Page number

size

No

String

Number of records on each page.

Table 4 TimeRangeBean

Parameter

Mandatory

Parameter Type

Description

end_time

No

String

End time. This parameter must be used together with start_time. The format must be yyyy-MM-dd HH:mm:ss. Time when an action occurred, in UTC time.

start_time

No

String

Start time. This parameter must be used together with end_time. The format must be yyyy-MM-dd HH:mm:ss. Time when an action occurred, in UTC time.

time_range

No

String

Query time range. This parameter cannot be used together with start_time and end_time. If they are used together, this parameter has a higher priority.

  • HALF_HOUR
  • HOUR
  • THREE_HOUR
  • TWELVE_HOUR
  • DAY
  • WEEK
  • MONTH

Response Parameters

Status code: 200

Table 5 Response body parameter

Parameter

Parameter Type

Description

total_num

Integer

Total number

operate_log

Array of OperateLogInfo objects

Operation log list

Table 6 OperateLogInfo

Parameter

Parameter Type

Description

id

String

Operation log ID.

user

String

Operation log username

time

String

Time when a record is generated. The format is timestamp.

action

String

Operation type of a record. The value can be:

  • create
  • update
  • delete
  • download

function

String

Function type of the record.

name

String

Operation object of a record

description

String

Description of a record

result

String

Execution result of a record. The value can be:

  • success
  • fail

Status code: 400

Table 7 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 8 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 403

Table 9 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 10 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 11 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 12 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Request

/v1/{project_id}/{instance_id}/dbss/audit/operate-log

{
  "time" : {
    "time_range" : "HOUR"
  },
  "page" : 1,
  "size" : 10
}

Example Responses

Status code: 200

Succeeded

{
  "total_num" : 3,
  "operate_log" : [ {
    "id" : "1LJP-HgBCwCqSg3BVuAp",
    "user" : "hby-test",
    "time" : "2021-04-22 06:40:52",
    "function": "Database list",
    "action": "Delete",
    "name" : "db01 ",
    "description":": Delete the audited database,
    "result" : "success"
  }, {
    "id" : "07JO-HgBCwCqSg3ByOAD",
    "user" : "hby-test",
    "time" : "2021-04-22 06:40:15",
    "function": "Database list",
    "action": "Update",
    "name" : "db01 ",
    "description": "Close the audit client",
    "result" : "success"
  }, {
    "id" : "ULKM93gBCwCqSg3BZeD1",
    "user" : "hby-test",
    "time" : "2021-04-22 03:07:56",
    "function": "Database list",
    "action": "Create",
    "name" : "db01",
    "description": "Create a new database",
    "result" : "success"
  } ]
}

Status code: 400

Request Parameter Error

{
  "error" : {
    "error_code" : "DBSS.XXXX",
    "error_msg" : "XXX"
  }
}

Status code: 500

Internal Server Error

{
  "error" : {
    "error_code" : "DBSS.XXXX",
    "error_msg" : "XXX"
  }
}

Status Code

Status Code

Description

200

Success

400

Incorrect request parameter.

403

Authentication failed.

500

Internal Server Error

Error Codes

For details, see Error Codes.