調用DescribeSqlLogTask介面,查詢DAS企業版離線任務詳情。
介面說明
使用該介面需滿足以下前提條件:
使用阿里雲或 DAS 的 SDK 時,建議使用最新版本。
在使用 SDK 調用 DAS 服務時,需要將地區指定為 cn-shanghai。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
hdm:DescribeSqlLogTask |
get |
*全部資源
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| InstanceId |
string |
否 |
資料庫執行個體 ID。 |
r-bp1nti25tc7bq5**** |
| TaskId |
string |
否 |
任務 ID。 |
a4f5c4494dbd6713185d87a97aa53e8 |
| PageNo |
integer |
否 |
分頁查詢的頁碼,從 1 開始,預設為 1。 |
1 |
| PageSize |
integer |
否 |
分頁查詢每頁最大記錄數,最大支援 100,預設為 10。 |
10 |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
根節點或根目錄 |
||
| Code |
string |
返回的狀態代碼。 |
200 |
| Message |
string |
請求返回訊息。 說明
請求成功時該參數返回 Successful,請求失敗時會返回請求異常資訊(如錯誤碼等)。 |
Successful |
| RequestId |
string |
請求 ID。 |
B6D17591-B48B-4D31-9CD6-9B9796B2**** |
| Success |
string |
請求是否執行成功:
|
true |
| Data |
object |
返回資料。 |
|
| Name |
string |
任務名稱。 |
SQL審計匯出1 |
| TaskId |
string |
任務 ID。 |
9a4f5c4494dbd6713185d87a97aa53e8 |
| TaskType |
string |
任務類型。
|
Query |
| CreateTime |
integer |
任務建立時間,格式為 unix 時間戳記,單位為毫秒。 |
1681363254423 |
| Status |
string |
任務狀態。
說明
當任務處於 COMPLETED 時,可以查看離線任務的結果。 |
COMPLETED |
| Expire |
boolean |
任務是否到期。
|
false |
| Start |
integer |
查詢開始時間,格式為 unix 時間戳記,單位為毫秒。 |
1596177993000 |
| End |
integer |
查詢結束時間,格式為 unix 時間戳記,單位為毫秒。 |
1608888296000 |
| Filters |
array<object> |
過濾條件。 |
|
|
object |
查詢篩選條件。 |
||
| Key |
string |
過濾參數的名稱。 說明
支援的過濾參數及其取值請參考返回參數補充說明。 |
keyWords |
| Value |
any |
過濾參數的值。 |
select |
| Total |
integer |
任務總數。 |
1 |
| Queries |
array<object> |
離線查詢任務結果。 當 TaskType == Query 時才會返回該值。 |
|
|
object |
離線查詢任務結果。 |
||
| Vip |
string |
查詢連結的 endpoint 解析地址。 |
10.146.XX.XX |
| NodeId |
string |
子節點 ID。 |
pi-bp1o58x3ib7e6**** |
| SqlText |
string |
SQL 陳述式詳情。 |
SELECT @@session.transaction_read_only |
| SqlType |
string |
選擇 SQL 的類型。取值:
|
SELECT |
| State |
string |
執行結果。
|
0 |
| DBName |
string |
資料庫名稱。 |
testdb01 |
| SqlId |
string |
SQL ID。 |
a4111670e80596c5bf42cf5154438a91 |
| ExecuteTime |
string |
執行時間,格式為 UTC 時間: |
2023-12-07T02:15:32Z |
| OriginTime |
integer |
執行時間戳記,格式為 Unix 時間,單位為毫秒。 |
1701886532000 |
| AccountName |
string |
資料庫帳號。 |
testname |
| HostAddress |
string |
用戶端 IP 位址。 |
11.197.XX.XX |
| Consume |
integer |
執行耗時,單位毫秒。 |
58 |
| LockTime |
integer |
鎖等待時間,單位毫秒。 |
0 |
| UpdateRows |
integer |
更新行數。 |
0 |
| ScanRows |
integer |
掃描行數。 |
0 |
| ReturnRows |
integer |
返回行數。 |
0 |
| LogicRead |
integer |
邏輯讀。 |
0 |
| PhysicSyncRead |
integer |
物理同步讀。 |
0 |
| PhysicAsyncRead |
integer |
物理非同步讀。 |
0 |
| ThreadId |
integer |
線程 ID。 |
None |
| TrxId |
string |
事務 ID。 |
200000 |
| Ext |
string |
擴充資訊欄位,備用參數。 |
None |
| Scnt |
integer |
PolarDB-X 2.0 計算節點(CN)的 DN 請求數。 |
10 |
| Rows |
integer |
PolarDB-X 2.0 資料庫執行個體計算節點總更新或返回的行數。 |
10 |
| Frows |
integer |
PolarDB-X 2.0 計算節點(CN)的拉取行數。 |
10 |
| TraceId |
string |
PolarDB-X 2.0 的跟蹤 ID,即 SQL 在資料節點的執行 ID。 |
14c93b7c7bf00000 |
| UseImciEngine |
string |
PolarDB MySQL 版執行個體是否使用列存索引。
|
true |
| ParallelDegree |
string |
PolarDB MySQL 版執行個體的並行排隊時間,單位為毫秒。 |
10 |
| ParallelQueueTime |
string |
PolarDB MySQL 版執行個體的並行度。 |
2 |
| PhysicRead |
integer |
物理讀。 |
0 |
| CpuTime |
integer |
CPU 執行時間,單位為微秒。 |
100 |
| Writes |
integer |
RDS SQL Server 引擎的寫入數。 |
10 |
| Collection |
string |
預留參數 |
None |
| SqlCommand |
integer |
查詢中的 SQL 命令 |
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 |
匯出任務的下載地址。當 TaskType == Export 時才會返回該值。 |
"https://das-sqllog-download-cn-hongkong.oss-cn-hongkong.aliyuncs.com/****" |
Key 支援的參數和取值:
KeyWords:關鍵字,多個關鍵字間使用空格隔開。
LogicalOperator:關鍵字間的邏輯操作,取值為 and 或 or。
AccountName:使用者名稱,可以傳遞多個的,用逗號分開,上限為 5。
dbName:資料庫名稱,可以傳遞多個的,用逗號分開,上限為 5。
HostAddress:用戶端 IP 位址,可以傳遞多個的,用逗號分開,上限為 5。
MaxConsume:最大耗時,單位 us。
MinConsume:最小耗時,單位 us。
MaxScanRows:最大掃描行。
MinScanRows:最小掃描行。
SqlType:SQL 類型,取值 select、update、insert 或 delete。
State:執行結果,取值 0(成功)或 1(失敗)。
ThreadId:線程 ID。
SortKey:排序列名稱,取值 ScanRows(掃描行數)、UpdateRows(更新行數)、Consume(耗時)、ExecuteTime(執行時間)、ReturnRows(返回行數)、LockTime(鎖等待時間)、Frows(PolarDB-X 2.0 計算節點的拉取行數)、Scnt(PolarDB-X 2.0 計算節點的 DN 請求數)、CpuTime(CPU 執行時間)、PhysicalRead(物理讀)。
SortMethod:排序方式,取值 DESC(降序)、ASC(升序)。預設為 DESC。
TraceId:PolarDB-X 2.0 執行個體的跟蹤 ID。
MinRows:最小更新行數。
MaxRows:最大更新行數。
MinScnt:PolarDB-X 2.0 計算節點(CN)的 DN 最小請求數。
MaxScnt:PolarDB-X 2.0 計算節點(CN)的 DN 最大請求數。
TrxId:事務 ID。
Fail:錯誤碼。
SqlId:SQL ID。
樣本
正常返回樣本
JSON格式
{
"Code": "200",
"Message": "Successful",
"RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Success": "true",
"Data": {
"Name": "SQL審計匯出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/****\""
}
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | 請求參數錯誤 |
| 403 | NoPermission | You are not authorized to do this action. | 沒有許可權執行該操作 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。