Call DescribeSqlLogRecords to query log details in DAS Enterprise Edition.
Operation description
Before calling this operation, note the following:
When you use an Alibaba Cloud or Database Autonomy Service (DAS) SDK, we recommend that you use the latest version.
When you call the DAS service by using an SDK, you must set the region to
cn-shanghai.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:DescribeSqlLogRecords |
list |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The ID of the database instance. |
pc-2ze8g2am97624**** |
| NodeId |
string |
No |
The node ID.
|
pi-uf6k5f6g3912i**** |
| Role |
string |
No |
The role of the node in the PolarDB-X 2.0 database instance.
|
polarx_cn |
| Filters |
array<object> |
No |
A list of filter conditions. |
|
|
object |
No |
The filter condition. |
||
| Key |
string |
No |
The filter key. Note
For details on supported filter keys and their values, see Additional information about request parameters. |
keyWords |
| Value |
string |
No |
The filter value. |
select |
| StartTime |
integer |
No |
The beginning of the time range to query. This is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC. |
1596177993000 |
| EndTime |
integer |
No |
The end of the time range to query. This is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC. |
1608888296000 |
| PageNo |
integer |
No |
The page number. 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 |
The following values are supported for the Key parameter:
KeyWords: The keywords for the query. Separate multiple keywords with a space.
LogicalOperator: The logical operator that connects keywords. Valid values:
andandor.AccountName: The database username. You can specify up to five usernames, separated by commas.
dbName: The database name. You can specify up to five database names, separated by commas.
HostAddress: The client IP address. You can specify up to five IP addresses, separated by commas.
MaxConsume: The maximum execution duration, in microseconds.
MinConsume: The minimum execution duration, in microseconds.
MaxScanRows: The maximum number of scanned rows.
MinScanRows: The minimum number of scanned rows.
SqlType: The sql type. Valid values:
select,update,insert, anddelete.State: The execution state. Valid values:
0(successful) and1(failed).ThreadId: The thread ID.
SortKey: The sort key. 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 pulled by a compute node (CN)),Scnt(number of requests from a CN to a data node (DN)),CpuTime(CPU execution time), andPhysicalRead(physical reads).SortMethod: The sort order. Valid values:
DESC(descending) andASC(ascending). Default value:DESC.TraceId: The trace ID.
MinRows: The minimum number of updated rows.
MaxRows: The maximum number of updated rows.
MinScnt: The minimum number of requests from a CN to a DN.
MaxScnt: The maximum number of requests from a CN to a DN.
TrxId: The transaction ID.
Fail: The error code.
SqlId: The sql ID.
JobId: The asynchronous task ID. Use this ID to query the execution result of the task.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The root node. |
||
| Code |
string |
The HTTP status code. |
200 |
| Message |
string |
The returned message. Note
If the request is successful, Successful is returned. Otherwise, an error message is returned. |
Successful |
| RequestId |
string |
The request ID. |
F43E7FB3-CE67-5FFD-A59C-EFD278BCD7BE |
| Success |
string |
Indicates whether the request was successful. Valid values:
|
true |
| Data |
object |
The returned data. |
|
| StartTime |
integer |
The start time of the query. This value is a UNIX timestamp. Unit: milliseconds. |
1596177993000 |
| EndTime |
integer |
The end time of the query. This value is a UNIX timestamp. Unit: milliseconds. |
1608888296000 |
| TotalRecords |
integer |
The total number of entries returned. |
1 |
| Items |
object |
The details of the SQL logs. |
|
| SQLLogRecord |
array<object> |
The SQL log data. |
|
|
object |
The SQL log data. |
||
| Ext |
string |
The extended information. This parameter is reserved. |
None |
| ExecuteTime |
string |
The execution time. The time is in UTC. Format: |
2023-12-07T02:15:32Z |
| OriginTime |
integer |
The execution time. This value is a UNIX timestamp. Unit: milliseconds. |
1701886532000 |
| HostAddress |
string |
The client IP address. |
11.197.XX.XX |
| UpdateRows |
integer |
The number of updated rows. |
0 |
| LogicRead |
integer |
The number of logical reads. |
0 |
| SqlText |
string |
The SQL statement. |
select resource_id as cluster_id, tpl_name \n\tfrom dbfree_alert_resource_tpl_ref\n\twhere user_id=? and type='cluster' group by resource_id, tpl_name |
| LockTime |
integer |
The lock wait time. Unit: milliseconds. |
0 |
| ScanRows |
integer |
The number of scanned rows. |
0 |
| ThreadId |
integer |
The thread ID. |
None |
| State |
string |
The execution status. Valid values:
|
0 |
| DBName |
string |
The database name. |
testdb |
| SqlType |
string |
The type of the SQL statement. |
select |
| AccountName |
string |
The database account. |
testname |
| PhysicSyncRead |
integer |
The number of synchronous physical reads. |
0 |
| PhysicAsyncRead |
integer |
The number of asynchronous physical reads. |
0 |
| TrxId |
string |
The transaction ID. |
200000 |
| ReturnRows |
integer |
The number of returned rows. |
0 |
| Consume |
integer |
The execution duration. Unit: microseconds (μs). |
58 |
| Vip |
string |
The endpoint that is resolved from the query connection string. |
100.115.XX.XX |
| NodeId |
string |
The node ID. |
pi-uf6k5f6g3912i**** |
| SqlId |
string |
The SQL ID. |
c67649d4a7fb62c4f8c7a447c52b5b17 |
| UseImciEngine |
string |
Indicates whether an In-Memory Column Index (IMCI) is used for the PolarDB for MySQL instance.
|
true |
| ParallelQueueTime |
string |
The parallel queue time for the PolarDB for MySQL instance. Unit: milliseconds. |
2 |
| ParallelDegree |
string |
The degree of parallelism (DOP) for the PolarDB for MySQL instance. |
10 |
| Scnt |
integer |
The number of requests sent from a compute node (CN) to data nodes (DNs) in a PolarDB-X 2.0 instance. |
10 |
| Rows |
integer |
The total number of rows updated or returned by the compute node (CN) of a PolarDB-X 2.0 instance. |
10 |
| Frows |
integer |
The number of rows fetched by the compute node (CN) in a PolarDB-X 2.0 instance. |
10 |
| TraceId |
string |
The trace ID for a PolarDB-X 2.0 instance. This is the ID of the SQL statement that was executed on a data node (DN). |
14c93b7c7bf00000 |
| PhysicRead |
integer |
The number of physical reads. |
0 |
| CpuTime |
integer |
The CPU execution time. Unit: microseconds (μs). |
100 |
| Writes |
integer |
The number of write operations on an ApsaraDB RDS for SQL Server instance. |
10 |
| Collection |
string |
This parameter is reserved. |
None |
| TableName |
string |
The name of the table that the SQL statement references. |
das |
| ConnectionId |
string |
The connection ID. |
ld-****** |
| Protocol |
string |
The protocol type. |
MySQL |
| Params |
string |
The SQL parameters. |
[1, "das"] |
| ClientIp |
string |
The client IP address. |
10.0.0.1xx |
| ClientPort |
integer |
The client port. |
3306 |
| RowKey |
string |
The row key of the SQL log record. |
23 |
| AffectColumns |
string |
The affected columns. |
["col1"] |
| Finish |
string |
Indicates whether the task is complete. Valid values:
Note
If this parameter is 0 and the JobId parameter is returned, the current request is an asynchronous request and you cannot obtain the returned results. You must use the value of JobId to initiate another request. Set the Filters parameter to the value of JobId. Example: |
1 |
| JobId |
string |
The asynchronous task ID. |
MzI4NTZfUUlOR0RBT19DTTlfTlUyMF9NWVNRTF9PREJTX0xWU18zMjg1Nl9teXNxbF9XZWQgTWFyIDA2IDE0OjUwOjQ3IENTVCAyMDI0XzBfMzBfRXhlY3V0ZVRpbWVfREVTQ19XZWQgTWFyIDA2IDE0OjM1OjQ3IENTVCAyMDI0Xw==_1709708406465 |
Examples
Success response
JSON format
{
"Code": "200",
"Message": "Successful",
"RequestId": "F43E7FB3-CE67-5FFD-A59C-EFD278BCD7BE",
"Success": "true",
"Data": {
"StartTime": 1596177993000,
"EndTime": 1608888296000,
"TotalRecords": 1,
"Items": {
"SQLLogRecord": [
{
"Ext": "None",
"ExecuteTime": "2023-12-07T02:15:32Z",
"OriginTime": 1701886532000,
"HostAddress": "11.197.XX.XX",
"UpdateRows": 0,
"LogicRead": 0,
"SqlText": "select resource_id as cluster_id, tpl_name \\n\\tfrom dbfree_alert_resource_tpl_ref\\n\\twhere user_id=? and type='cluster' group by resource_id, tpl_name",
"LockTime": 0,
"ScanRows": 0,
"ThreadId": 0,
"State": "0",
"DBName": "testdb",
"SqlType": "select",
"AccountName": "testname",
"PhysicSyncRead": 0,
"PhysicAsyncRead": 0,
"TrxId": "200000",
"ReturnRows": 0,
"Consume": 58,
"Vip": "100.115.XX.XX",
"NodeId": "pi-uf6k5f6g3912i****",
"SqlId": "c67649d4a7fb62c4f8c7a447c52b5b17",
"UseImciEngine": "true",
"ParallelQueueTime": "2",
"ParallelDegree": "10",
"Scnt": 10,
"Rows": 10,
"Frows": 10,
"TraceId": "14c93b7c7bf00000 ",
"PhysicRead": 0,
"CpuTime": 100,
"Writes": 10,
"Collection": "None",
"TableName": "das",
"ConnectionId": "ld-******",
"Protocol": "MySQL",
"Params": "[1, \"das\"]",
"ClientIp": "10.0.0.1xx",
"ClientPort": 3306,
"RowKey": "23",
"AffectColumns": "[\"col1\"]"
}
]
},
"Finish": "1",
"JobId": "MzI4NTZfUUlOR0RBT19DTTlfTlUyMF9NWVNRTF9PREJTX0xWU18zMjg1Nl9teXNxbF9XZWQgTWFyIDA2IDE0OjUwOjQ3IENTVCAyMDI0XzBfMzBfRXhlY3V0ZVRpbWVfREVTQ19XZWQgTWFyIDA2IDE0OjM1OjQ3IENTVCAyMDI0Xw==_1709708406465"
}
}
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.