Memanggil operasi DescribeAuditLogRecords untuk mengkueri log audit SQL kluster Edisi Gudang Data.
Deskripsi operasi
Before you call this operation to view the SQL audit logs of an AnalyticDB for MySQL cluster, enable SQL Audit. Call the DescribeAuditLogConfig operation to query the status of SQL Audit. If SQL Audit is disabled, call the ModifyAuditLogConfig operation to enable it.
You can query SQL audit logs only when SQL Audit is enabled. You can query only the SQL audit logs from the last 30 days. If you disable SQL Audit and then re-enable it, you can query only the SQL audit logs that are generated after it is re-enabled. SQL audit logs do not record INSERT INTO VALUES, REPLACE INTO VALUES, or UPSERT INTO VALUES operations.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
adb:DescribeAuditLogRecords |
get |
DBCluster
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| DBClusterId |
string |
Yes |
ID kluster Edisi Gudang Data. Catatan
Panggil operasi DescribeDBClusters untuk melihat ID semua kluster Edisi Gudang Data di wilayah tujuan. |
am-t4nj8619bz2w3**** |
| RegionId |
string |
Yes |
ID wilayah. Catatan
Panggil operasi DescribeRegions untuk melihat wilayah dan zona, termasuk ID wilayah, yang didukung oleh AnalyticDB for MySQL. |
cn-hangzhou |
| StartTime |
string |
No |
Awal rentang waktu untuk dikueri. Tentukan waktu dalam format yyyy-MM-ddTHH:mmZ. Waktu harus dalam UTC. Catatan
Anda hanya dapat mengkueri log audit SQL ketika Audit SQL diaktifkan. Anda hanya dapat mengkueri log audit SQL dari 30 hari terakhir. Jika Anda menonaktifkan lalu mengaktifkan kembali Audit SQL, Anda hanya dapat mengkueri log yang dihasilkan setelah diaktifkan kembali. |
2022-01-23T02:18Z |
| EndTime |
string |
No |
Akhir pengatur waktu untuk dikueri. Tentukan waktu dalam format yyyy-MM-ddTHH:mmZ. Waktu harus dalam UTC. Catatan
|
2022-01-23T22:18Z |
| DBName |
string |
No |
Nama database tempat pernyataan SQL dieksekusi. |
adb_demo |
| QueryKeyword |
string |
No |
Kata kunci untuk kueri. Kata kunci ini digunakan untuk memfilter pernyataan SQL. |
adb |
| SqlType |
string |
No |
Tipe pernyataan SQL. Nilai valid:
Catatan
Anda hanya dapat mengkueri satu tipe pernyataan SQL sekaligus. Jika Anda membiarkan parameter ini kosong, semua tipe pernyataan SQL akan dikueri. |
SELECT |
| Succeed |
string |
No |
Apakah pernyataan SQL berhasil dieksekusi. Nilai valid:
|
true |
| HostAddress |
string |
No |
Alamat IP dan nomor Port klien yang digunakan untuk mengeksekusi pernyataan SQL. |
100.104.XX.XX:43908 |
| OrderType |
string |
No |
Urutan pengurutan hasil kueri berdasarkan waktu eksekusi pernyataan SQL. Nilai valid:
|
asc |
| User |
string |
No |
Nama pengguna yang digunakan untuk mengeksekusi pernyataan SQL. |
test_user |
| Order |
string |
No |
Urutan pengurutan hasil kueri. Tentukan nilai sebagai array JSON terurut. Hasil diurutkan berdasarkan urutan bidang dalam array. Setiap objek dalam array berisi bidang
|
[{"Field":"ExecuteTime","Type":"Desc"},{"Field":"HostAddress","Type":"Asc"}] |
| PageSize |
integer |
No |
Jumlah entri yang dikembalikan pada setiap halaman. Nilai valid:
Catatan
Jika Anda tidak menentukan parameter ini, nilai default adalah 10. |
10 |
| PageNumber |
integer |
No |
Nomor halaman. Nilai harus berupa bilangan bulat yang lebih besar dari 0 dan tidak melebihi nilai maksimum tipe data integer. Nilai default: 1. |
1 |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
The details. |
||
| TotalCount |
string |
The total number of entries. |
1 |
| PageSize |
string |
The number of entries returned per page. |
10 |
| RequestId |
string |
The request ID. |
8A564B7F-8C00-43C0-8EC5-919FBB70573 |
| PageNumber |
string |
The page number. |
1 |
| DBClusterId |
string |
The cluster ID. |
am-t4nj8619bz2w3**** |
| Items |
array<object> |
The details of the SQL audit logs. |
|
|
object |
The list. |
||
| HostAddress |
string |
The IP address and port number of the client that was used to execute the SQL statement. |
100.104.XX.XX:43908 |
| Succeed |
string |
Indicates whether the SQL statement was successfully executed. Valid values:
|
true |
| SQLText |
string |
The details of the SQL statement. |
SELECT * FROM tb_courses |
| TotalTime |
string |
The execution duration of the SQL statement. Unit: milliseconds (ms). |
216 |
| ConnId |
string |
This parameter is invalid. |
无 |
| DBName |
string |
The name of the database on which the SQL statement was executed. |
adb_test |
| SQLType |
string |
The type of the SQL statement. |
SELECT |
| ProcessID |
string |
The task ID. |
202106081752021720161662490345362390 |
| User |
string |
The username that was used to execute the SQL statement. |
test_user |
| ExecuteTime |
string |
The start time of the SQL statement execution. The time is in the yyyy-MM-dd HH:mm:ss format and is your local time. |
2022-01-23 16:05:08 |
| ExecuteTimestamp |
integer |
Contoh
Respons sukses
JSONformat
{
"TotalCount": "1",
"PageSize": "10",
"RequestId": "8A564B7F-8C00-43C0-8EC5-919FBB70573",
"PageNumber": "1",
"DBClusterId": "am-t4nj8619bz2w3****",
"Items": [
{
"HostAddress": "100.104.XX.XX:43908",
"Succeed": "true",
"SQLText": "SELECT * FROM tb_courses",
"TotalTime": "216",
"ConnId": "无",
"DBName": "adb_test",
"SQLType": "SELECT",
"ProcessID": "202106081752021720161662490345362390",
"User": "test_user",
"ExecuteTime": "2022-01-23 16:05:08",
"ExecuteTimestamp": 0
}
]
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 404 | InvalidDBCluster.NotFound | The DBClusterId provided does not exist in our records. | The specified DBClusterId parameter does not exist. Make sure that the DBClusterId value is valid. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.