Panggil DescribeSqlLogRecords untuk membuat kueri detail log di DAS Enterprise Edition.
Deskripsi operasi
Sebelum memanggil operasi ini, perhatikan hal berikut:
-
Saat Anda menggunakan SDK Alibaba Cloud atau Database Autonomy Service (DAS), kami menyarankan agar Anda menggunakan versi terbaru.
-
Saat Anda memanggil layanan DAS dengan menggunakan SDK, Anda harus menyetel region ke
cn-shanghai.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:DescribeSqlLogRecords |
list |
*全部资源
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
ID instans database. |
pc-2ze8g2am97624**** |
| NodeId |
string |
No |
ID node.
|
pi-uf6k5f6g3912i**** |
| Role |
string |
No |
Peran node dalam instans database PolarDB-X 2.0.
|
polarx_cn |
| Filters |
array<object> |
No |
Daftar kondisi filter. |
|
|
object |
No |
Kondisi filter. |
||
| Key |
string |
No |
Kunci filter. Catatan
Untuk detail mengenai kunci filter yang didukung dan nilainya, lihat Informasi tambahan tentang parameter permintaan. |
keyWords |
| Value |
string |
No |
Nilai filter. |
select |
| StartTime |
integer |
No |
Awal rentang waktu yang akan dikueri. Ini adalah timestamp UNIX yang merepresentasikan jumlah milidetik yang telah berlalu sejak 1 Januari 1970, 00:00:00 UTC. |
1596177993000 |
| EndTime |
integer |
No |
Akhir rentang waktu yang akan dikueri. Ini adalah timestamp UNIX yang merepresentasikan jumlah milidetik yang telah berlalu sejak 1 Januari 1970, 00:00:00 UTC. |
1608888296000 |
| PageNo |
integer |
No |
Nomor halaman. Halaman dimulai dari halaman 1. Nilai default: 1. |
1 |
| PageSize |
integer |
No |
Jumlah entri per halaman. Nilai maksimum: 100. Nilai default: 10. |
10 |
Nilai berikut didukung untuk parameter Key:
-
KeyWords: Kata kunci untuk kueri. Pisahkan beberapa kata kunci dengan spasi.
-
LogicalOperator: Operator logika yang menghubungkan kata kunci. Nilai yang valid:
anddanor. -
AccountName: Nama pengguna database. Anda dapat menentukan hingga lima nama pengguna, dipisahkan dengan koma.
-
dbName: Nama database. Anda dapat menentukan hingga lima nama database, dipisahkan dengan koma.
-
HostAddress: Alamat IP klien. Anda dapat menentukan hingga lima alamat IP, dipisahkan dengan koma.
-
MaxConsume: Durasi eksekusi maksimum, dalam mikrodetik.
-
MinConsume: Durasi eksekusi minimum, dalam mikrodetik.
-
MaxScanRows: Jumlah maksimum baris yang dipindai.
-
MinScanRows: Jumlah minimum baris yang dipindai.
-
SqlType: Jenis sql. Nilai yang valid:
select,update,insert, dandelete. -
State: Status eksekusi. Nilai yang valid:
0(berhasil) dan1(gagal). -
ThreadId: ID thread.
-
SortKey: Kunci pengurutan. Nilai yang valid:
ScanRows(jumlah baris yang dipindai),UpdateRows(jumlah baris yang diperbarui),Consume(durasi eksekusi),ExecuteTime(waktu eksekusi),ReturnRows(jumlah baris yang dikembalikan),LockTime(waktu tunggu kunci),Frows(jumlah baris yang ditarik oleh compute node (CN)),Scnt(jumlah permintaan dari CN ke data node (DN)),CpuTime(waktu eksekusi CPU), danPhysicalRead(pembacaan fisik). -
SortMethod: Urutan pengurutan. Nilai yang valid:
DESC(menurun) danASC(menaik). Nilai default:DESC. -
TraceId: ID jejak.
-
MinRows: Jumlah minimum baris yang diperbarui.
-
MaxRows: Jumlah maksimum baris yang diperbarui.
-
MinScnt: Jumlah minimum permintaan dari CN ke DN.
-
MaxScnt: Jumlah maksimum permintaan dari CN ke DN.
-
TrxId: ID transaksi.
-
Fail: Kode error.
-
SqlId: ID sql.
-
JobId: ID tugas asinkron. Gunakan ID ini untuk membuat kueri hasil eksekusi tugas.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
Node akar. |
||
| Code |
string |
Kode status HTTP. |
200 |
| Message |
string |
Pesan yang dikembalikan. Catatan
Jika permintaan berhasil, Successful akan dikembalikan. Jika tidak, pesan error akan dikembalikan. |
Successful |
| RequestId |
string |
ID permintaan. |
F43E7FB3-CE67-5FFD-A59C-EFD278BCD7BE |
| Success |
string |
Menunjukkan apakah permintaan berhasil. Nilai yang valid:
|
true |
| Data |
object |
Data yang dikembalikan. |
|
| StartTime |
integer |
Waktu mulai kueri. Nilai ini adalah timestamp UNIX. Satuan: milidetik. |
1596177993000 |
| EndTime |
integer |
Waktu akhir kueri. Nilai ini adalah timestamp UNIX. Satuan: milidetik. |
1608888296000 |
| TotalRecords |
integer |
Jumlah total entri yang dikembalikan. |
1 |
| Items |
object |
Detail log SQL. |
|
| 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 Coordinated Universal Time (UTC) and the format is |
2023-12-07T02:15:32Z |
| OriginTime |
integer |
The execution timestamp. 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 (us). |
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. Valid values:
|
true |
| ParallelQueueTime |
string |
The degree of parallelism for the PolarDB for MySQL instance. |
2 |
| ParallelDegree |
string |
The parallel queuing time, in milliseconds, for a PolarDB for MySQL instance. |
10 |
| Scnt |
integer |
The number of requests from a compute node (CN) to a data node (DN) of a PolarDB-X 2.0 instance. |
10 |
| Rows |
integer |
The total number of rows updated or returned by the compute node of the PolarDB-X 2.0 database instance. |
10 |
| Frows |
integer |
The number of rows pulled by the CN 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 the data node. |
14c93b7c7bf00000 |
| PhysicRead |
integer |
The number of physical reads. |
0 |
| CpuTime |
integer |
The CPU execution time. Unit: microseconds. |
100 |
| Writes |
integer |
The number of writes for an ApsaraDB RDS for SQL Server instance. |
10 |
| Collection |
string |
This parameter is reserved. |
None |
| TableName |
string |
das |
|
| ConnectionId |
string |
ld-****** |
|
| Protocol |
string |
MySQL |
|
| Params |
string |
[1, "das"] |
|
| ClientIp |
string |
10.0.0.1xx |
|
| ClientPort |
integer |
3306 |
|
| RowKey |
string |
23 |
|
| AffectColumns |
string |
["col1"] |
|
| Finish |
string |
Menunjukkan apakah tugas telah selesai. Nilai yang valid:
Catatan
Jika parameter ini bernilai 0 dan parameter JobId dikembalikan, permintaan saat ini adalah permintaan asinkron dan Anda tidak dapat memperoleh hasil yang dikembalikan. Anda harus menggunakan nilai JobId untuk menginisiasi permintaan lain. Setel parameter Filters ke nilai JobId. Contoh: |
1 |
| JobId |
string |
ID tugas asinkron. |
MzI4NTZfUUlOR0RBT19DTTlfTlUyMF9NWVNRTF9PREJTX0xWU18zMjg1Nl9teXNxbF9XZWQgTWFyIDA2IDE0OjUwOjQ3IENTVCAyMDI0XzBfMzBfRXhlY3V0ZVRpbWVfREVTQ19XZWQgTWFyIDA2IDE0OjM1OjQ3IENTVCAyMDI0Xw==_1709708406465 |
Contoh
Respons sukses
JSONformat
{
"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"
}
}
Kode kesalahan
|
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. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.