Queries the audit logs of SQL statements that are executed in Data Management (DMS).
Debugging
Authorization information
There is currently no authorization information disclosed in the API.
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
StartTime | string | Yes | The beginning of the time range to query. Note
The start time supports fuzzy match. Specify the time in the YYYY-MM-DD hh:mm:ss format.
| 2021-11-08 11:04:00 |
EndTime | string | Yes | The end of the time range to query. Note
The end time supports fuzzy match. Specify the time in the YYYY-MM-DD hh:mm:ss format. We recommend that you use the StartTime and EndTime parameters to specify a time range that does not exceed one day. The returned entries can be displayed by page to improve query efficiency.
| 2021-11-08 11:00:00 |
SearchName | string | No | The name of the database or instance based on which you want to query SQL statements. Note
If the SQL statements to be queried are at the instance level, you can set this parameter to an instance name. If the SQL statements to be queried are at the database level, you can set this parameter to a database name.
| test_SearchName |
OpUserName | string | No | The nickname of the user who wrote the SQL statement. | test_OpUserName |
SqlType | string | No | The type of the SQL statement. Valid values:
Note
To view more types of SQL statements, log on to the DMS console and click Security and Specifications. In the left-side navigation pane, click Operation Audit. Then, you can view all supported types of SQL statements from the SQL type drop-down list.
| SELECT |
ExecState | string | No | The execution status of the SQL statement. Valid values:
| SUCCESS |
PageSize | integer | Yes | The number of entries to return on each page. The value cannot exceed 100. | 20 |
PageNumber | integer | Yes | The number of the page to return. | 1 |
Tid | long | No | The ID of the tenant. You can call the GetUserActiveTenant operation to obtain the tenant ID. | 3*** |
Response parameters
Examples
Sample success responses
JSON
format
{
"TotalCount": 1,
"RequestId": "39BC9C86-95AE-58F2-9862-A7C3D896****",
"ErrorCode": "MissingStartTime",
"ErrorMessage": "StartTime is mandatory for this action.",
"Success": true,
"SQLExecAuditLogList": {
"SQLExecAuditLog": [
{
"OpTime": "2021-11-08 11:04:27",
"UserName": "test_UserName",
"UserId": 0,
"InstanceName": "polar123@pc-bp1h9tgq4st9g****.mysql.polardb.rds.aliyuncs.com:3306[polar_qw_test]",
"InstanceId": 0,
"SchemaName": "polar123",
"DbId": 0,
"Logic": false,
"SQLType": "SELECT",
"SQL": "SELECT * FROM `polar123`.`p_qw` ORDER BY `id` DESC",
"ExecState": "SUCCESS",
"AffectRows": 2,
"ElapsedTime": 18,
"Remark": "success"
}
]
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-03-23 | The internal configuration of the API is changed, but the call is not affected | View Change Details |