GetDasSQLLogHotData
Retrieves hot audit log data.
Operation description
To use this operation, the following prerequisites must be met:
Use the latest version of the Alibaba Cloud SDK or DAS SDK.
Specify cn-shanghai as the region when you use the SDK to call DAS.
This 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 start time of the query cannot be earlier than 7 days ago. The interval between the start time and the end time cannot exceed 1 day. This 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 a UNIX timestamp in milliseconds. Note
You can only query data generated after DAS Enterprise Edition is enabled. The start time cannot be earlier than 7 days before the current time. |
1684734297000 |
| End |
integer |
Yes |
The end time of the query. The time is a UNIX timestamp in 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 queries are supported. You can specify 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 specify multiple database accounts for a combined query. Separate multiple accounts with spaces. Example: |
testuser |
| DBName |
string |
No |
The database name. Note
You can specify multiple database names for a combined query. Separate multiple names with spaces. Example: |
testDB |
| HostAddress |
string |
No |
The IP address of the client. Note
You can specify multiple client IP addresses for a combined query. Separate multiple 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, in 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, in 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. Enter 0 to query SQL statements that were 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 specify 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 sorting criterion. Valid values:
|
ScanRows |
| SortMethod |
string |
No |
The sorting method. Valid values:
|
ASC |
| ChildDBInstanceIDs |
string |
No |
The node ID. Note
For PolarDB for MySQL instances, 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. |
0 |
| MaxRows |
integer |
No |
The reserved parameter. This parameter is not supported. |
10 |
| MinSpillCnt |
integer |
No |
The reserved parameter. This parameter is not supported. |
0 |
| MaxSpillCnt |
integer |
No |
The reserved parameter. This parameter is not supported. |
0 |
| TransactionId |
string |
No |
The transaction ID. |
0 |
| Fail |
string |
No |
The error code returned for the SQL execution. You can call the GetAsyncErrorRequestStatByCode operation to obtain the error code. |
1064 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The returned 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 ID of the request. |
0A74B755-98B7-59DB-8724-1321B394**** |
| Success |
string |
Indicates whether the request was 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, in microseconds. |
10000 |
| Ext |
string |
The extended information field. This is a reserved parameter. |
None |
| ExecuteTime |
string |
The execution time in UTC. Format: |
2023-05-23 T12:11:20Z |
| OriginTime |
string |
The execution time in 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 number of logical reads. |
12 |
| SQLText |
string |
The details of the SQL statement. |
select 1 |
| LockTime |
integer |
The lock wait time, in 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 was 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.