Mengkueri entri log audit untuk instans MongoDB.
Deskripsi operasi
-
When you call this operation, ensure that the audit log feature of the instance is enabled. Otherwise, the operation returns an empty audit log.
-
This operation is applicable only to general-purpose local-disk and dedicated local-disk instances.
-
You can call this operation up to 30 times per minute. To call this operation at a higher frequency, use a Logstore. For more information, see Manage a Logstore.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dds:DescribeAuditRecords |
get |
*dbinstance
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| DBInstanceId |
string |
Yes |
ID instans. Catatan
Jika Anda menetapkan parameter ini ke ID instans kluster sharded, Anda juga harus menentukan parameter NodeId. |
dds-bp12c5b040dc**** |
| NodeId |
string |
No |
ID node Mongos atau node shard di instans kluster sharded. Catatan
Parameter ini hanya tersedia ketika DBInstanceId ditetapkan ke ID instans kluster sharded. |
d-bp128a003436**** |
| StartTime |
string |
Yes |
Awal rentang pengatur waktu untuk dikueri. Tentukan pengatur waktu dalam format yyyy-MM-ddTHH:mm:ssZ. Pengatur waktu harus dalam UTC. |
2019-03-13T12:11:14Z |
| EndTime |
string |
Yes |
Akhir pengatur waktu untuk dikueri. Waktu akhir harus lebih lambat dari waktu mulai. Tentukan waktu dalam format yyyy-MM-ddTHH:mm:ssZ. Waktu harus dalam UTC. Catatan
Pengatur waktu antara waktu mulai dan waktu akhir tidak boleh melebihi 24 jam. Jika tidak, operasi akan gagal. |
2019-03-13T13:11:14Z |
| Database |
string |
No |
Nama database. Secara default, semua database dikueri. |
database**** |
| User |
string |
No |
Akun database. Secara default, semua akun dikueri. |
test |
| Form |
string |
No |
Format catatan audit yang dikembalikan. Nilai valid:
Catatan
Parameter File sudah tidak digunakan lagi. |
Stream |
| QueryKeywords |
string |
No |
Kata kunci untuk kueri. Anda dapat menentukan hingga 10 kata kunci. Pisahkan beberapa kata kunci dengan spasi. |
slow |
| LogicalOperator |
string |
No |
Operator logika untuk pencarian kata kunci. Nilai default adalah and. |
and |
| PageSize |
integer |
No |
Jumlah entri yang dikembalikan di setiap halaman. Nilai valid: 30 (default), 50, dan 100. |
30 |
| PageNumber |
integer |
No |
Nomor halaman yang dikembalikan. Nilai harus lebih besar dari 0 dan tidak boleh melebihi nilai maksimum tipe data integer. Nilai default: 1. |
1 |
| OrderType |
string |
No |
Pesanan pengurutan entri log audit yang dikembalikan berdasarkan pengatur waktu. Nilai valid:
|
asc |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| TotalRecordCount |
integer |
The total number of entries. |
40 |
| PageRecordCount |
integer |
The number of entries on the current page. |
30 |
| RequestId |
string |
The request ID. |
3278BEB8-503B-4E46-8F7E-D26E040C9769 |
| PageNumber |
integer |
The page number. |
1 |
| Items |
object |
||
| SQLRecord |
array<object> |
The list of audit log details. |
|
|
object |
The details of an audit log entry. |
||
| HostAddress |
string |
The IP address of the client. |
11.xxx.xxx.xxx |
| TableName |
string |
The name of the MongoDB collection. |
C1 |
| ReturnRowCounts |
integer |
The number of returned rows. |
2 |
| DBName |
string |
The database name. |
test123 |
| ExecuteTime |
string |
The time when the statement was executed. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC. |
2019-03-11T03:30:27Z |
| ThreadID |
string |
The thread ID. |
140682188297984 |
| TotalExecutionTimes |
integer |
The execution time, in microseconds. |
700 |
| Syntax |
string |
The executed statement. |
{ \"atype\" : \"createCollection\", \"param\" : { \"ns\" : \"123.test1\" }, \"result\": \"OK\" } |
| AccountName |
string |
The name of the database account. |
test |
Contoh
Respons sukses
JSONformat
{
"TotalRecordCount": 40,
"PageRecordCount": 30,
"RequestId": "3278BEB8-503B-4E46-8F7E-D26E040C9769",
"PageNumber": 1,
"Items": {
"SQLRecord": [
{
"HostAddress": "11.xxx.xxx.xxx",
"TableName": "C1",
"ReturnRowCounts": 2,
"DBName": "test123",
"ExecuteTime": "2019-03-11T03:30:27Z",
"ThreadID": "140682188297984",
"TotalExecutionTimes": 700,
"Syntax": "{ \\\"atype\\\" : \\\"createCollection\\\", \\\"param\\\" : { \\\"ns\\\" : \\\"123.test1\\\" }, \\\"result\\\": \\\"OK\\\" }",
"AccountName": "test"
}
]
}
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidStartTime.Format | Specified start time is not valid. | |
| 400 | InvalidEndTime.Format | Specified end time is not valid. | |
| 400 | InvalidEndTime.Invalid | Specified end time is before this service active time. | |
| 400 | InvalidParameterCombination | The end time must be greater than the start time. | |
| 400 | InvalidQueryKeyword.Format | Specified Query Keyword is not valid. | |
| 400 | InvalidDatabase.Format | Specified Database is not valid. | |
| 400 | InvalidQueryTime.Format | Specified query time is not valid. | |
| 403 | IncorrectSQLLogActiveStatus | Current DB instance SQL log active status does not support this operation. | |
| 403 | LogApiFrequencyExceeded | Exceeding the allowed frequency of log api. | |
| 403 | ConcurrentTaskExceeded | Concurrent task exceeding the allowed amount. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.