You can call the DescribeSqlLogTask operation to query the details of an offline task for DAS Enterprise Edition.
Operation description
Before you call this operation, note the following:
-
Use the latest version of the Alibaba Cloud SDK or DAS SDK.
-
If 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:DescribeSqlLogTask |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
No |
The database instance ID. |
r-bp1nti25tc7bq5**** |
| TaskId |
string |
No |
The task ID. |
a4f5c4494dbd6713185d87a97aa53e8 |
| PageNo |
integer |
No |
The number of the page to return. Pages start from page 1. Default value: 1. |
1 |
| PageSize |
integer |
No |
The number of entries per page. Maximum value: 100. Default value: 10. |
10 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The HTTP status code returned. |
200 |
| Message |
string |
The message returned for the request. Note
If the request was successful, Successful is returned. If the request failed, an error message is returned. |
Successful |
| RequestId |
string |
The request ID. |
B6D17591-B48B-4D31-9CD6-9B9796B2**** |
| Success |
string |
Indicates whether the request was successful. Valid values:
|
true |
| Data |
object |
The data returned. |
|
| Name |
string |
The task name. |
SQL audit export 1 |
| TaskId |
string |
The task ID. |
9a4f5c4494dbd6713185d87a97aa53e8 |
| TaskType |
string |
The task type.
|
Query |
| CreateTime |
integer |
The time when the task was created. This is a UNIX timestamp. Unit: ms. |
1681363254423 |
| Status |
string |
The task status.
Note
You can view the task result when the task is in the COMPLETED state. |
COMPLETED |
| Expire |
boolean |
Indicates whether the task has expired.
|
false |
| Start |
integer |
The beginning of the time range to query. This is a UNIX timestamp. Unit: ms. |
1596177993000 |
| End |
integer |
The end of the time range to query. This is a UNIX timestamp. Unit: ms. |
1608888296000 |
| Filters |
array<object> |
The filter conditions. |
|
|
object |
The query filter conditions. |
||
| Key |
string |
The name of the filter parameter. Note
For more information about the supported filter parameters and their valid values, see the "Additional information about response parameters" section. |
keyWords |
| Value |
any |
The value of the filter parameter. |
select |
| Total |
integer |
The total number of entries returned. |
1 |
| Queries |
array<object> |
The results of the offline query task. This parameter is returned only when TaskType is Query. |
|
|
object |
The results of the offline query task. |
||
| Vip |
string |
The endpoint address that the query link resolves to. |
10.146.XX.XX |
| NodeId |
string |
The node ID. |
pi-bp1o58x3ib7e6**** |
| SqlText |
string |
The details of the SQL statement. |
SELECT @@session.transaction_read_only |
| SqlType |
string |
The type of the SQL statement. Valid values:
|
SELECT |
| State |
string |
The execution result.
|
0 |
| DBName |
string |
The database name. |
testdb01 |
| SqlId |
string |
The SQL ID. |
a4111670e80596c5bf42cf5154438a91 |
| ExecuteTime |
string |
The time when the SQL statement was executed. The time is in the |
2023-12-07T02:15:32Z |
| OriginTime |
integer |
The time when the SQL statement was executed. This is a UNIX timestamp. Unit: ms. |
1701886532000 |
| AccountName |
string |
The database account. |
testname |
| HostAddress |
string |
The client IP address. |
11.197.XX.XX |
| Consume |
integer |
The execution duration. Unit: ms. |
58 |
| LockTime |
integer |
The lock wait time. Unit: ms. |
0 |
| UpdateRows |
integer |
The number of updated rows. |
0 |
| ScanRows |
integer |
The number of scanned rows. |
0 |
| ReturnRows |
integer |
The number of returned rows. |
0 |
| LogicRead |
integer |
The number of logical reads. |
0 |
| PhysicSyncRead |
integer |
The number of physical synchronous reads. |
0 |
| PhysicAsyncRead |
integer |
Physical (asynchronous) read. |
0 |
| ThreadId |
integer |
The thread ID. |
None |
| TrxId |
string |
The transaction ID. |
200000 |
| Ext |
string |
Reserved for future use. |
None |
| Scnt |
integer |
The number of requests sent from compute nodes to data nodes of a PolarDB-X 2.0 instance. |
10 |
| Rows |
integer |
The total number of rows updated or returned by the compute nodes of a PolarDB-X 2.0 database instance. |
10 |
| Frows |
integer |
The number of rows fetched by the compute nodes of a PolarDB-X 2.0 instance. |
10 |
| TraceId |
string |
The trace ID of a PolarDB-X 2.0 instance. This is the ID of the SQL statement that is executed on a data node. |
14c93b7c7bf00000 |
| UseImciEngine |
string |
Indicates whether an In-Memory Column Index (IMCI) is used for the PolarDB for MySQL instance.
|
true |
| ParallelDegree |
string |
The parallel queuing time for a PolarDB MySQL instance, in milliseconds. |
10 |
| ParallelQueueTime |
string |
The degree of parallelism of the PolarDB for MySQL instance. |
2 |
| PhysicRead |
integer |
The number of physical reads. |
0 |
| CpuTime |
integer |
The CPU execution time. Unit: μs. |
100 |
| Writes |
integer |
The number of writes for the ApsaraDB RDS for SQL Server engine. |
10 |
| Collection |
string |
Reserved. |
None |
| SqlCommand |
integer |
sql |
|
| ConnectionId |
string |
ld-****** |
|
| Protected |
string |
MySQL |
|
| Params |
string |
[1, "das"] |
|
| ClientIp |
string |
10.0.0.1xx |
|
| ClientPort |
integer |
3306 |
|
| RowKey |
string |
23 |
|
| AffectColumns |
string |
["col1"] |
|
| TableName |
string |
das |
|
| Export |
string |
The download URL for the exported file. This parameter is returned only when TaskType is Export. |
"https://das-sqllog-download-cn-hongkong.oss-cn-hongkong.aliyuncs.com/****" |
The following keys are supported for the Key parameter:
-
KeyWords: Keywords. You can separate multiple keywords with a space.
-
LogicalOperator: The logical operator used to combine keywords. Valid values are and and or.
-
AccountName: The username. You can specify up to five usernames and separate them with commas (,).
-
dbName: The database name. You can specify up to five database names and separate them with commas (,).
-
HostAddress: The client IP address. You can specify up to five IP addresses and separate them with commas (,).
-
MaxConsume: The maximum execution duration in microseconds (μs).
-
MinConsume: The minimum execution duration in microseconds (μs).
-
MaxScanRows: The maximum number of scanned rows.
-
MinScanRows: The minimum number of scanned rows.
-
SqlType: The SQL type. Valid values are select, update, insert, and delete.
-
State: The execution result. Valid values are 0 (successful) and 1 (failed).
-
ThreadId: The thread ID.
-
SortKey: The metric that is used to sort the query results. Valid values: ScanRows (number of scanned rows), UpdateRows (number of updated rows), Consume (execution duration), ExecuteTime (execution time), ReturnRows (number of returned rows), LockTime (lock wait time), Frows (number of rows fetched by compute nodes of a PolarDB-X 2.0 instance), Scnt (number of requests sent from compute nodes to data nodes of a PolarDB-X 2.0 instance), CpuTime (CPU execution time), and
PhysicalRead(number of physical reads). -
SortMethod: The sorting order. Valid values are DESC (descending) and ASC (ascending). The default value is
DESC. -
TraceId: The trace ID of a PolarDB-X 2.0 instance.
-
MinRows: The minimum number of updated rows.
-
MaxRows: The maximum number of updated rows.
-
MinScnt: The minimum number of requests sent from compute nodes to data nodes of a PolarDB-X 2.0 instance.
-
MaxScnt: The maximum number of requests sent from compute nodes to data nodes of a PolarDB-X 2.0 instance.
-
TrxId: The transaction ID.
-
Fail: The error code.
-
SqlId: The SQL ID.
Examples
Success response
JSON format
{
"Code": "200",
"Message": "Successful",
"RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Success": "true",
"Data": {
"Name": "SQL audit export 1\n",
"TaskId": "9a4f5c4494dbd6713185d87a97aa53e8\n",
"TaskType": "Query",
"CreateTime": 1681363254423,
"Status": "COMPLETED",
"Expire": true,
"Start": 1596177993000,
"End": 1608888296000,
"Filters": [
{
"Key": "keyWords\n",
"Value": "select"
}
],
"Total": 1,
"Queries": [
{
"Vip": "10.146.XX.XX",
"NodeId": "pi-bp1o58x3ib7e6****\n",
"SqlText": "SELECT @@session.transaction_read_only",
"SqlType": "SELECT",
"State": "0",
"DBName": "testdb01",
"SqlId": "a4111670e80596c5bf42cf5154438a91",
"ExecuteTime": "2023-12-07T02:15:32Z",
"OriginTime": 1701886532000,
"AccountName": "testname\n",
"HostAddress": "11.197.XX.XX\n",
"Consume": 58,
"LockTime": 0,
"UpdateRows": 0,
"ScanRows": 0,
"ReturnRows": 0,
"LogicRead": 0,
"PhysicSyncRead": 0,
"PhysicAsyncRead": 0,
"ThreadId": 0,
"TrxId": "200000\n",
"Ext": "None",
"Scnt": 10,
"Rows": 10,
"Frows": 10,
"TraceId": "14c93b7c7bf00000 ",
"UseImciEngine": "true\n",
"ParallelDegree": "10\n",
"ParallelQueueTime": "2",
"PhysicRead": 0,
"CpuTime": 100,
"Writes": 10,
"Collection": "None",
"SqlCommand": 0,
"ConnectionId": "ld-******",
"Protected": "MySQL",
"Params": "[1, \"das\"]",
"ClientIp": "10.0.0.1xx",
"ClientPort": 3306,
"RowKey": "23",
"AffectColumns": "[\"col1\"]",
"TableName": "das"
}
],
"Export": "\"https://das-sqllog-download-cn-hongkong.oss-cn-hongkong.aliyuncs.com/****\""
}
}
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.