Queries hot data of audit logs.
Operation description
Before you call this operation, take note of the following items:
- If you use an Alibaba Cloud SDK or DAS SDK to call this operation, we recommend that you use the latest version of the SDK.
- If you use an SDK to call API operations of DAS, you must set the region ID to cn-shanghai.
- This operation is applicable to PolarDB for MySQL, ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, and ApsaraDB RDS for SQL Server.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
hdm:GetDasSQLLogHotData | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
InstanceId | string | Yes | The ID of the database instance. | rm-2ze1jdv45i7l6**** |
Start | long | Yes | The beginning of the time range to query. Specify a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC. Note
The beginning of the time range to query must be later than the time when DAS Enterprise Edition is enabled, and can be up to seven days earlier than the current time.
| 1684734297000 |
End | long | Yes | The end of the time range to query. Set this parameter to a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC. Note
The end time must be later than the start time. The interval between the start time and the end time cannot exceed 24 hours.
| 1684820697000 |
QueryKeyword | string | No | The keyword that is used for the query. Note
Fuzzy search is not supported. You can query data by using multiple keywords. Separate keywords with spaces.
| test |
AccountName | string | No | The account of the database. Note
You can specify multiple database accounts that are separated by spaces. Example: user1 user2 user3 .
| testuser |
DBName | string | No | The name of the database. Note
You can specify multiple database names that are separated by spaces. Example: DB1 DB2 DB3 .
| testDB |
HostAddress | string | No | The IP address of the client. Note
You can specify multiple IP addresses that are separated by spaces. Example: IP1 IP2 IP3 .
| 47.100.XX.XX |
LogicalOperator | string | No | The logical relationship among multiple keywords.
| or |
MaxLatancy | long | No | The maximum execution duration. Unit: microseconds. You can specify this parameter to query the SQL statements whose execution duration is smaller than the value of this parameter. | 100 |
MaxScanRows | long | No | The maximum number of scanned rows. You can specify this parameter to query the SQL statements that scan a smaller number of rows than the value of this parameter. | 10000 |
MinLatancy | long | No | The minimum execution duration. Unit: microseconds. You can specify this parameter to query the SQL statements whose execution duration is greater than or equal to the value of this parameter. | 10 |
MinScanRows | long | No | The minimum number of scanned rows. You can specify this parameter to query the SQL statements that scan a larger or an equal number of rows than the value of this parameter. | 10 |
SqlType | string | No | The type of the SQL statement. Valid values:
| SELECT |
State | string | No | The execution results. You can specify 0 to query the SQL statements that are successfully executed. You can also specify an error code to query the corresponding SQL statements that fail to be executed. | 0 |
ThreadID | string | No | The thread ID. Note
You can specify multiple thread IDs that are separated by spaces. Example: Thread ID1 Thread ID2 Thread ID3 .
| 657 |
PageNumbers | long | No | The page number. Pages start from page 1. Default value: 1. | 2 |
MaxRecordsPerPage | long | No | The maximum number of entries per page. Valid values: 5 to 100. | 10 |
SortKey | string | No | The basis on which you want to sort the query results.
| SCAN_ROWS |
SortMethod | string | No | The order in which you want to sort the query results.
| ase |
ChildDBInstanceIDs | string | No | The node ID. Note
This parameter must be specified if the database instance is a PolarDB for MySQL cluster.
| pi-bp179lg03445l**** |
Role | string | No | The reserved parameter. This parameter is not supported. | None |
TraceId | string | No | The reserved parameter. This parameter is not supported. | None |
MinRows | long | No | The reserved parameter. This parameter is not supported. | None |
MaxRows | long | No | The reserved parameter. This parameter is not supported. | None |
MinSpillCnt | long | No | The reserved parameter. This parameter is not supported. | None |
MaxSpillCnt | long | No | The reserved parameter. This parameter is not supported. | None |
TransactionId | string | No | The transaction ID. | 0 |
Fail | string | No | The error code of SQL execution. You can call the GetAsyncErrorRequestStatByCode operation to query MySQL error codes in SQL Explorer data. | 1064 |
Response parameters
Examples
Sample success responses
JSON
format
{
"Code": "200",
"Data": {
"Extra": "None",
"List": [
{
"AccountName": "testuser",
"DBName": "testDB",
"ExecuteTime": "2023-05-23 T12:11:20Z",
"Ext": "None",
"HostAddress": "47.100.XX.XX",
"Latancy": 10000,
"LockTime": 1,
"LogicRead": 12,
"OriginTime": "2023-05-23 T12:11:20.999Z",
"PhysicAsyncRead": 0,
"PhysicSyncRead": 0,
"ReturnRows": 1,
"SQLText": "select 1",
"ScanRows": 29,
"SqlType": "SELECT",
"State": "0",
"ThreadID": 657,
"TransactionId": "0",
"UpdateRows": 30
}
],
"PageNo": 2,
"PageSize": 10,
"Total": 20
},
"Message": "Successful",
"RequestId": "0A74B755-98B7-59DB-8724-1321B394****",
"Success": "true"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | InvalidParams | The request parameters are invalid. |
403 | NoPermission | You are not authorized to do this action. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-06-04 | The Error code has changed | View Change Details |