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.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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 primary instance.

NodeId String No d-bpxxxxxxxx

The ID of the mongos or shard 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 Integer No 30

The number of records on each page. Valid values: 30, 50, and 100. Default value: 30.

PageNumber Integer No 1

The number of the page to return. Valid values: any non-zero positive integer. Default value: 1.

RegionId String No cn-hangzhou

The region ID of the instance. You can call the DescribeDBInstanceAttribute operation to query the region ID of the instance.

AccessKeyId String No LTAIgbTGpxxxxxx

The AccessKey ID that Alibaba Cloud provides for you to access services.

Response parameters

Parameter Type Example Description
Items

The information about all audit files.

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.

  • Success: The audit log files are archived.
  • Failed: The audit log files failed to be archived.
  • Generating: The audit log files are in the process of being archived.
  • Initializing: Archiving is not started.
PageNumber Integer 1

The page number of the returned page.

PageRecordCount Integer 1

The number of records on the current page.

RequestId String F8CA8312-530 A- 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>

Successful response examples

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
			}
		]
	},
	"TotalRecordCount":1,
	"PageNumber":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.