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
|
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
|
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.) |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
time |
No |
TimeRangeBean object |
Query time range |
|
user_name |
No |
String |
Operation log username |
|
action |
No |
String |
Action
|
|
result |
No |
String |
Execution result
|
|
page |
No |
String |
Page number |
|
size |
No |
String |
Number of records on each page. |
|
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.
|
Response Parameters
Status code: 200
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
total_num |
Integer |
Total number |
|
operate_log |
Array of OperateLogInfo objects |
Operation log list |
|
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:
|
|
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:
|
Status code: 400
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error |
Object |
Error message. |
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error_code |
String |
Error code |
|
error_msg |
String |
Error message |
Status code: 403
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error |
Object |
Error message. |
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error_code |
String |
Error code |
|
error_msg |
String |
Error message |
Status code: 500
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error |
Object |
Error message. |
|
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.