Retrieves the hot data of audit logs.
Operation description
To use this API operation, the following prerequisites must be met:
When you use the Alibaba Cloud SDK or the DAS SDK, use the latest version.
When you call DAS by using the SDK, you must set the region to cn-shanghai.
This API operation is applicable to PolarDB for MySQL, ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, and ApsaraDB RDS for SQL Server.
Log indexing is enabled for the instance.
The query start time cannot be earlier than 7 days ago. The interval between the query start time and the query end time cannot exceed 1 day. This API operation returns a maximum of 10,000 records.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:GetDasSQLLogHotData |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The database instance ID. |
rm-2ze1jdv45i7l6**** |
| Start |
integer |
Yes |
The start time of the query. The time is in the UNIX timestamp format. Unit: milliseconds. Note
You can only query data generated after DAS Enterprise Edition is enabled. The start time cannot be more than 7 days earlier than the current time. |
1684734297000 |
| End |
integer |
Yes |
The end time of the query. The time is in the UNIX timestamp format. Unit: milliseconds. Note
The end time must be later than the start time, and the interval between the start time and the end time cannot exceed 1 day. |
1684820697000 |
| QueryKeyword |
string |
No |
The keyword. Note
Fuzzy match is supported. You can use a maximum of 10 keywords for a combined query. Separate multiple keywords with spaces. Example: a1 b2 c3. |
a1 b2 |
| AccountName |
string |
No |
The database account. Note
You can use multiple database accounts for a combined query. Separate multiple database accounts with spaces. Example: |
testuser |
| DBName |
string |
No |
The database name. Note
You can use multiple database names for a combined query. Separate multiple database names with spaces. Example: |
testDB |
| HostAddress |
string |
No |
The IP address of the client. Note
You can use multiple client IP addresses for a combined query. Separate multiple client IP addresses with spaces. Example: |
47.100.XX.XX |
| LogicalOperator |
string |
No |
The logical relationship between multiple keywords. Valid values:
|
or |
| MaxLatancy |
integer |
No |
The maximum execution duration. Unit: microseconds. This parameter is used to query SQL statements whose execution duration is less than the specified value. |
100 |
| MaxScanRows |
integer |
No |
The maximum number of scanned rows. This parameter is used to query SQL statements whose number of scanned rows is less than the specified value. |
10000 |
| MinLatancy |
integer |
No |
The minimum execution duration. Unit: microseconds. This parameter is used to query SQL statements whose execution duration is greater than or equal to the specified value. |
10 |
| MinScanRows |
integer |
No |
The minimum number of scanned rows. This parameter is used to query SQL statements whose number of scanned rows is greater than or equal to the specified value. |
10 |
| SqlType |
string |
No |
The type of the SQL statement. Valid values:
Valid values:
|
select |
| State |
string |
No |
The execution result. If you enter 0, the system queries SQL statements that are successfully executed. You can also enter a specific error code to query the corresponding SQL statements. |
0 |
| ThreadID |
string |
No |
The thread ID. Note
You can use multiple thread IDs for a combined query. Separate multiple thread IDs with spaces. Example: |
657 |
| PageNumbers |
integer |
No |
The page number for the paging query. Pages start from 1. Default value: 1. |
2 |
| MaxRecordsPerPage |
integer |
No |
The maximum number of records per page for the paging query. Valid values: 5 to 100. |
10 |
| SortKey |
string |
No |
The sort key. Valid values:
|
ScanRows |
| SortMethod |
string |
No |
The sort order. Valid values:
|
ASC |
| ChildDBInstanceIDs |
string |
No |
The node ID. Note
For a PolarDB for MySQL instance, you must specify the node ID. |
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 |
integer |
No |
The reserved parameter. This parameter is not supported. |
None |
| MaxRows |
integer |
No |
The reserved parameter. This parameter is not supported. |
None |
| MinSpillCnt |
integer |
No |
The reserved parameter. This parameter is not supported. |
None |
| MaxSpillCnt |
integer |
No |
The reserved parameter. This parameter is not supported. |
None |
| TransactionId |
string |
No |
The transaction ID. |
0 |
| Fail |
string |
No |
The error code returned when the SQL statement is executed. You can call the GetAsyncErrorRequestStatByCode operation to obtain the error code. |
1064 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The returned HTTP status code. |
200 |
| Message |
string |
The returned message. Note
If the request is successful, Successful is returned. If the request fails, an error message, such as an error code, is returned. |
Successful |
| RequestId |
string |
The request ID, which is a unique identifier generated by Alibaba Cloud for the request. |
0A74B755-98B7-59DB-8724-1321B394**** |
| Success |
string |
Indicates whether the request is successful. Valid values:
|
true |
| Data |
object |
The returned data. |
|
| List |
array<object> |
The list of returned information. |
|
|
object |
The returned SQL Explorer and audit data. |
||
| Latancy |
integer |
The execution duration. Unit: microseconds. |
10000 |
| Ext |
string |
The extended information field. This is a reserved parameter. |
None |
| ExecuteTime |
string |
The execution time. The time is in the UTC format: |
2023-05-23 T12:11:20Z |
| OriginTime |
string |
The execution time. The time is in the UTC format: |
2023-05-23 T12:11:20.999Z |
| HostAddress |
string |
The IP address of the client. |
47.100.XX.XX |
| UpdateRows |
integer |
The number of updated rows. |
30 |
| LogicRead |
integer |
The logical reads. |
12 |
| SQLText |
string |
The details of the SQL statement. |
select 1 |
| LockTime |
integer |
The lock wait duration. Unit: microseconds. |
1 |
| ScanRows |
integer |
The number of scanned rows. |
29 |
| ThreadID |
integer |
The thread ID. |
657 |
| State |
string |
The status. A value of 0 indicates that the execution is successful. Otherwise, an error code is returned. |
0 |
| DBName |
string |
The name of the database. |
testDB |
| SqlType |
string |
The type of the SQL statement. Valid values:
|
select |
| AccountName |
string |
The database account. |
testuser |
| PhysicSyncRead |
integer |
The number of physical synchronous reads. |
0 |
| PhysicAsyncRead |
integer |
The number of physical asynchronous reads. |
0 |
| TransactionId |
string |
The ID of the started transaction. |
0 |
| ReturnRows |
integer |
The number of returned rows. |
1 |
| NodeId |
string |
The node ID. |
pi-bp120roy76f3qbd84 |
| Total |
integer |
The total number of returned records. |
20 |
| PageNo |
integer |
The page number. |
2 |
| PageSize |
integer |
The number of entries per page. |
10 |
| Extra |
any |
The reserved parameter. |
None |
Examples
Success response
JSON format
{
"Code": "200",
"Message": "Successful",
"RequestId": "0A74B755-98B7-59DB-8724-1321B394****",
"Success": "true",
"Data": {
"List": [
{
"Latancy": 10000,
"Ext": "None",
"ExecuteTime": "2023-05-23 T12:11:20Z",
"OriginTime": "2023-05-23 T12:11:20.999Z",
"HostAddress": "47.100.XX.XX",
"UpdateRows": 30,
"LogicRead": 12,
"SQLText": "select 1",
"LockTime": 1,
"ScanRows": 29,
"ThreadID": 657,
"State": "0",
"DBName": "testDB",
"SqlType": "select",
"AccountName": "testuser",
"PhysicSyncRead": 0,
"PhysicAsyncRead": 0,
"TransactionId": "0",
"ReturnRows": 1,
"NodeId": "pi-bp120roy76f3qbd84"
}
],
"Total": 20,
"PageNo": 2,
"PageSize": 10,
"Extra": "None"
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | The request parameters are invalid. |
| 403 | NoPermission | You are not authorized to do this action. | You do not have the permission to perform this operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.