You can call this operation to query the audit log files of MongoDB instances.
- This operation is applicable to replica set instances and sharded cluster instances. DescribeAuditFiles cannot be performed on standalone instances.
- This operation can only be called 30 times per minute. Do not call this operation at a high frequency. To make frequent calls, use a Logstore. For more information, see manage a Logstore.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeAuditFiles |
The operation that you want to perform. Set the value to DescribeAuditFiles. |
DBInstanceId | String | Yes | dds-bpxxxxxxxx |
The ID of the instance. |
NodeId | String | No | d-bpxxxxxxxx |
The ID of the mongos or shards in the specified cluster instance. Note If you do not specify this parameter, the audit logs of all mongos and shards will
be returned.
|
PageSize | String | No | 30 |
The number of records on each page. Valid values: 30, 50, 100. the default value is 30. |
PageNumber | Integer | No | 1 |
The number of the page to return. Valid values: any non-zero positive Integer. Default value: 1. |
Region ID | String | No | cn-hangzhou |
The region ID of the instance. You can call the operation DescribeDBInstanceAttribute to query. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Items | Array |
The information about all audit files. |
|
LogFile | |||
FileID | Integer | 406505 |
The ID of the file. |
LogDownloadURL | String | http://xxxxxxxx.oss-cn-hangzhou.aliyuncs.com/custinsxxxxxx/custinsxxxxxx_xxxxxx.csv |
The download link for audit log files. Note If the download link is unavailable, this parameter is empty.
|
LogEndTime | String | 2019-03-12T09:23:15Z |
The end time of audit logs, in the format of yyyy-MM-dd T HH:mm Z(UTC time). |
LogSize | Long | 98 |
The size of the audit log file. Unit: Bytes. |
LogStartTime | String | 2019-03-11T08:19:29Z |
The start time of the audit log. The time is in the format of yyyy-MM-dd T HH:mm Z(UTC time). |
LogStatus | String | success |
The status of the audit log file.
|
PageNumber | Integer | 1 |
The page number of the page returned. |
PageRecordCount | Integer | 1 |
The number of records on the current page. |
RequestId | String | F8CA8312-530A-413A-9129-F2BB32A8D404 |
The ID of the request. |
TotalRecordCount | Integer | 1 |
The total number of entries returned. |
Examples
Sample requests
http(s)://mongodb.aliyuncs.com/? Action=DescribeAuditFiles
&DBInstanceId=dds-bpxxxxxxxx
&<Common request parameters>
Sample success responses
XML
format
<DescribeAuditFilesResponse>
<Items>
<LogFile>
<LogStartTime>2019-03-11T08:19:29Z</LogStartTime>
<LogEndTime>2019-03-12T09:23:15Z</LogEndTime>
<LogStatus>Success</LogStatus>
<FileID>406505</FileID>
<LogDownloadURL>http://xxxxxxxx.oss-cn-hangzhou.aliyuncs.com/custinsxxxxxx/custinsxxxxxx_xxxxxx.csv</LogDownloadURL>
<LogSize>98</LogSize>
</LogFile>
</Items>
<PageNumber>1</PageNumber>
<TotalRecordCount>1</TotalRecordCount>
<RequestId>F8CA8312-530A-413A-9129-F2BB32A8D404</RequestId>
<PageRecordCount>1</PageRecordCount>
</DescribeAuditFilesResponse>
JSON
format
{
"Items": {
"LogFile": [
{
"LogStartTime": "2019-03-11T08:19:29Z",
"LogEndTime": "2019-03-12T09:23:15Z",
"LogStatus": "Success",
"FileID": 406505,
"LogDownloadURL": "http://xxxxxxxx.oss-cn-hangzhou.aliyuncs.com/custinsxxxxxx/custinsxxxxxx_xxxxxx.csv",
"LogSize": 98
}
]
},
"PageNumber": 1,
"TotalRecordCount": 1,
"RequestId": "F8CA8312-530A-413A-9129-F2BB32A8D404",
"PageRecordCount": 1
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
404 | InvalidDBInstanceClass.NotFound | Specified DB instance class is not found. | The error message returned when the specified instance type does not exists. Verify the specified instance type. |
403 | IncorrectDBInstanceType | Current DB instance type does not support this operation. | The error message returned because the operation is not supported by the current instance type. |
For a list of error codes, visit the API Error Center.