Retrieves hot data from audit logs.
Operation description
Before you use this API, ensure that the following requirements are met:
You are using the latest version of the Alibaba Cloud or DAS SDK.
When calling the DAS service with an SDK, set the region to cn-shanghai.
The database engine is one of the following: PolarDB MySQL, RDS MySQL, RDS PostgreSQL, or RDS SQL Server.
Log indexing is enabled for the instance.
The query start time cannot be earlier than 7 days ago. The interval between the start and end times must not exceed 1 day. This API returns up to 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 ID of the database instance. |
rm-2ze1jdv45i7l6**** |
| Start |
integer |
Yes |
Query start time in UNIX timestamp format, in milliseconds. Note
You can query only data generated after enabling DAS Enterprise Edition. The query start time cannot be earlier than 7 days before the current time. |
1684734297000 |
| End |
integer |
Yes |
Query end time in UNIX timestamp format, in milliseconds. Note
The query end time must be later than the query start time. The interval between the query start time and end time must not exceed 1 day. |
1684820697000 |
| QueryKeyword |
string |
No |
Keywords. Note
Fuzzy queries are supported. You can combine up to 10 keywords, separated by spaces. Example: a1 b2 c3. |
a1 b2 |
| AccountName |
string |
No |
Database account. Note
Supports combining multiple database accounts for queries, with accounts separated by spaces. Example: |
testuser |
| DBName |
string |
No |
Database name. Note
Supports combining multiple database names for queries, with names separated by spaces. Example: |
testDB |
| HostAddress |
string |
No |
Client IP address. Note
Supports combining multiple client IP addresses for queries, with addresses separated by spaces. Example: |
47.100.XX.XX |
| LogicalOperator |
string |
No |
Logical relationship between multiple keywords.
|
or |
| MaxLatancy |
integer |
No |
Maximum execution duration in microseconds. Queries SQL statements with execution durations less than this value. |
100 |
| MaxScanRows |
integer |
No |
Maximum number of scanned rows. Queries SQL statements with scanned rows less than this value. |
10000 |
| MinLatancy |
integer |
No |
Minimum execution duration in microseconds. Queries SQL statements with execution durations greater than or equal to this value. |
10 |
| MinScanRows |
integer |
No |
Minimum number of scanned rows. Queries SQL statements with scanned rows greater than or equal to this value. |
10 |
| SqlType |
string |
No |
SQL statement type. Valid values:
Valid values:
|
select |
| State |
string |
No |
Execution result. Enter 0 to query successfully executed SQL statements. You can also enter a specific error code to query corresponding SQL statements. |
0 |
| ThreadID |
string |
No |
Thread ID. Note
Supports combining multiple thread IDs for queries, with IDs separated by spaces. Example: |
657 |
| PageNumbers |
integer |
No |
Page number for paged query, starting from 1. Default value: 1. |
2 |
| MaxRecordsPerPage |
integer |
No |
Maximum number of records per page for paged query. Valid values: 5 to 100. |
10 |
| SortKey |
string |
No |
Sorting basis.
|
ScanRows |
| SortMethod |
string |
No |
Sorting method.
|
ASC |
| ChildDBInstanceIDs |
string |
No |
Node ID. Note
Required for PolarDB MySQL instances. |
pi-bp179lg03445l**** |
| Role |
string |
No |
Reserved parameter. Not currently supported. |
None |
| TraceId |
string |
No |
Reserved parameter. Not currently supported. |
None |
| MinRows |
integer |
No |
Reserved parameter. Not currently supported. |
None |
| MaxRows |
integer |
No |
Reserved parameter. Not currently supported. |
None |
| MinSpillCnt |
integer |
No |
Reserved parameter. Not currently supported. |
None |
| MaxSpillCnt |
integer |
No |
Reserved parameter. Not currently supported. |
None |
| TransactionId |
string |
No |
Transaction ID. |
0 |
| Fail |
string |
No |
SQL execution error code. Call GetAsyncErrorRequestStatByCode to get error codes. |
1064 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The status code. |
200 |
| Message |
string |
The response message. Note
If the request succeeds, this parameter returns Successful. If the request fails, it returns exception information such as an error code. |
Successful |
| RequestId |
string |
The unique request ID generated by Alibaba Cloud. |
0A74B755-98B7-59DB-8724-1321B394**** |
| Success |
string |
Indicates whether the request succeeded:
|
true |
| Data |
object |
The returned data. |
|
| List |
array<object> |
The list of returned information. |
|
|
object |
The returned SQL insight and audit data. |
||
| Latancy |
integer |
Execution duration in microseconds. |
10000 |
| Ext |
string |
Extended information field. Reserved parameter. |
None |
| ExecuteTime |
string |
Execution time in UTC format: |
2023-05-23 T12:11:20Z |
| OriginTime |
string |
Execution time in UTC format: |
2023-05-23 T12:11:20.999Z |
| HostAddress |
string |
Client IP address. |
47.100.XX.XX |
| UpdateRows |
integer |
Number of updated rows. |
30 |
| LogicRead |
integer |
Logical reads. |
12 |
| SQLText |
string |
SQL statement details. |
select 1 |
| LockTime |
integer |
Lock wait time in microseconds. |
1 |
| ScanRows |
integer |
Number of scanned rows. |
29 |
| ThreadID |
integer |
Thread ID. |
657 |
| State |
string |
Status. Returns 0 for successful execution. Otherwise, returns an error code. |
0 |
| DBName |
string |
Database name. |
testDB |
| SqlType |
string |
SQL type. Valid values:
|
select |
| AccountName |
string |
Database account. |
testuser |
| PhysicSyncRead |
integer |
Physical synchronous read. |
0 |
| PhysicAsyncRead |
integer |
Physical asynchronous read. |
0 |
| TransactionId |
string |
Initiated transaction ID. |
0 |
| ReturnRows |
integer |
Number of returned rows. |
1 |
| NodeId |
string |
||
| Total |
integer |
Total number of returned records. |
20 |
| PageNo |
integer |
Page number. |
2 |
| PageSize |
integer |
Number of entries per page. |
10 |
| Extra |
any |
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": ""
}
],
"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. | |
| 403 | NoPermission | You are not authorized to do this action. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.