Queries the list of SQL audit log tasks for an instance.
Operation description
Before calling this operation, note the following:
-
Use the latest version of the Alibaba Cloud software development kit (SDK) or the DAS SDK.
-
When you use an SDK to call the DAS service, set the region to cn-shanghai.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:DescribeSqlLogTasks |
list |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
No |
The ID of the database instance. |
r-bp1nti25tc7bq5**** |
| NodeId |
string |
No |
The node ID. Note
This parameter applies only to cluster instances. You can query offline tasks for a specific node. If you omit this parameter, the operation returns offline tasks for the primary node by default. |
pi-bp1o58x3ib7e6**** |
| Filters |
array<object> |
No |
A list of filter conditions. |
|
|
object |
No |
A filter condition. |
||
| Key |
string |
No |
The filter parameter. Note
For supported filter parameters and their valid values, see Additional information about request parameters. |
keyWords |
| Value |
string |
No |
The value of the filter parameter. |
select |
| StartTime |
integer |
No |
The start of the time range to query. This value is a UNIX timestamp in milliseconds. |
1596177993000 |
| EndTime |
integer |
No |
The end of the time range to query. This value is a UNIX timestamp in milliseconds. |
1608888296000 |
| PageNo |
integer |
No |
The page number. Pages start from 1. Default value: 1. |
1 |
| PageSize |
integer |
No |
The number of entries per page. Maximum value: 100. Default value: 10. |
10 |
The following parameters and values are supported for Key:
-
taskId: The task ID.
-
keyWords: The task name.
-
status: The task status. Valid values: INIT (pending scheduling), RUNNING (running), FAILED (failed), CANCELED (canceled), and COMPLETED (completed).
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The HTTP status code. |
200 |
| Message |
string |
The returned message. Note
If the request succeeds, Successful is returned. If the request fails, an error message is returned. |
Successful |
| RequestId |
string |
The request ID. |
B6D17591-B48B-4D31-9CD6-9B9796B2**** |
| Success |
string |
Indicates whether the request succeeded. Valid values:
|
true |
| Data |
object |
The returned data. |
|
| List |
array<object> |
The list of returned data. |
|
|
array<object> |
The returned data. |
||
| TaskId |
string |
The task ID. |
9a4f5c4494dbd6713185d87a97aa53e8 |
| InstanceId |
string |
The ID of the database instance. |
r-bp1nti25tc7bq5**** |
| Name |
string |
The name of the task. |
SQL audit export 1 |
| Start |
integer |
The start time of the task. This value is a UNIX timestamp in milliseconds. |
1683859555482 |
| End |
integer |
The end time of the task. This value is a UNIX timestamp in milliseconds. |
1705975320000 |
| Status |
string |
The task status. Valid values:
Note
You can view the result of an offline task only when its status is COMPLETED. |
RUNNING |
| LogCount |
integer |
The total number of logs. |
99999 |
| Progress |
integer |
The progress of the task. |
100 |
| ScanFileSize |
integer |
The number of scanned files. |
3000 |
| Expire |
boolean |
Indicates whether the task has expired. Valid values:
|
false |
| CreateTime |
integer |
The time when the task was created. This value is a UNIX timestamp in milliseconds. |
1681363254423 |
| AnalysisTaskFinishTime |
integer |
The time when the analysis task completed. This value is a UNIX timestamp in milliseconds. |
1712751923000 |
| AnalysisTaskStatus |
string |
The status of the analysis task. Note
This is an internal parameter. Ignore it. |
SCAN_ANALYZE_COMPLETED |
| Result |
string |
The URL returned if TaskType is set to Export. |
https://das-sqllog-download-cn-shanghai.oss-cn-shanghai.aliyuncs.com/la |
| TaskType |
string |
The task type. Valid values:
|
Export |
| Filters |
array<object> |
The filter conditions. |
|
|
object |
A filter condition. |
||
| Key |
string |
The filter parameter. Note
For supported filter parameters and their valid values, see Additional information about request parameters. |
keyWords |
| Value |
string |
The value of the filter parameter. |
select |
| InnerResult |
string |
||
| Total |
integer |
The total number of tasks. |
40 |
| PageNo |
integer |
The page number. |
1 |
| PageSize |
integer |
The number of entries per page. |
10 |
Examples
Success response
JSON format
{
"Code": "200",
"Message": "Successful",
"RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Success": "true",
"Data": {
"List": [
{
"TaskId": "9a4f5c4494dbd6713185d87a97aa53e8",
"InstanceId": "r-bp1nti25tc7bq5****\n",
"Name": "SQL audit export 1",
"Start": 1683859555482,
"End": 1705975320000,
"Status": "RUNNING",
"LogCount": 99999,
"Progress": 100,
"ScanFileSize": 3000,
"Expire": false,
"CreateTime": 1681363254423,
"AnalysisTaskFinishTime": 1712751923000,
"AnalysisTaskStatus": "SCAN_ANALYZE_COMPLETED",
"Result": "https://das-sqllog-download-cn-shanghai.oss-cn-shanghai.aliyuncs.com/la",
"TaskType": "Export",
"Filters": [
{
"Key": "keyWords\n",
"Value": "select\n"
}
],
"InnerResult": ""
}
],
"Total": 40,
"PageNo": 1,
"PageSize": 10
}
}
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.