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

Query Operation Logs

Function

This API is used to query user operation logs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

instance_id

Yes

String

Instance ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-type

Yes

String

The fixed value of this parameter is application/json;charset=UTF-8, which cannot be changed.

X-Auth-Token

Yes

String

User token

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

time

No

TimeRangeBean object

Time range

user_name

No

String

Filter users to obtain operation logs

operate_name

No

String

Filter object names to obtain operation logs

The value can be : DOWNLOAD

result

No

String

Filter execution results to obtain operation logs [success, fail]

page

No

String

Page number

size

No

String

Number of records on each page

Table 4 TimeRangeBean

Parameter

Mandatory

Type

Description

end_time

No

String

Start time. This parameter must be used together with end_time. The format must be yyyy-MM-dd HH:mm:ss.(UTC)

start_time

No

String

End time. This parameter must be used together with start_time. The format must be yyyy-MM-dd HH:mm:ss.(UTC)

time_range

No

String

Query time segment. The value can be : HALF_HOUR HOUR THREE_HOUR TWELVE_HOUR DAY (24 hours), WEEK (7 days), or MONTH (30 days). Enumerated value: HALF_HOUR HOUR THREE_HOUR TWELVE_HOUR DAY WEEK MONTH

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

total_num

Integer

Total

operate_log

Array of OperateLogInfo objects

Operation log list

Table 6 OperateLogInfo

Parameter

Type

Description

id

String

Operation log ID

user

String

Operation log user

time

String

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

function

String

Function type of the record.[Create new protected database, Create new user's email config, Update user's email config, Update user's alarm config, Delete system alarm record, Rules -> Sensitive Data Protect and so on.]

action

String

Operation type of the record. create: create update: update operate: operation (switch) delete: delete

name

String

Operation object of the record.

description

String

Description of the record.

result

String

Execution result of the user in the record. success indicates success. fail indicates failure.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 8 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 10 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 12 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Example Requests

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

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

Example Responses

Status code: 200

Success

{
  "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 an 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 agent.",
    "result" : "success"
  }, {
    "id" : "ULKM93gBCwCqSg3BZeD1",
    "user" : "hby-test",
    "time" : "2021-04-22 03:07:56",
    "function" : "Database list",
    "action" : "Create",
    "name" : "db01",
    "description" : "Create a database.",
    "result" : "success"
  } ]
}

Status code: 400

Invalid parameter.

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

Status code: 500

Internal server error.

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

Status Codes

Status Code

Description

200

Success

400

Invalid parameter.

403

Authentication failed.

500

Internal server error.

Error Codes

See Error Codes.