You can call this operation to enable or disable the audit log feature or set the log storage period for an ApsaraDB for MongoDB instance.

This operation is applicable to replica set instances and sharded cluster 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
AuditStatus String Yes enable

The status of the audit log. Valid values:

  • enable
  • disabled
DBInstanceId String Yes dds-bpxxxxxxxx

The ID of the instance.

Action String No ModifyAuditPolicy

The operation that you want to perform. Set the value to ModifyAuditPolicy.

StoragePeriod Integer No 30

The number of days that audit logs are stored. Valid values: 1 to 30. Default value: 30.

AccessKeyId String No LTAIgbTGpxxxxxx

The AccessKey ID provided to you by Alibaba Cloud.

Response parameters

Parameter Type Example Description
RequestId String DC04D812-F18D-4568-9B88-F260D9590116

The ID of the request.

Examples

Sample requests


http(s)://mongodb.aliyuncs.com/? Action=ModifyAuditPolicy
&AuditStatus=enable
&DBInstanceId=dds-bpxxxxxxxx
&<Common request parameters>

Sample success responses

XML format

<ModifyAuditPolicyResponse>
	  <RequestId>DC04D812-F18D-4568-9B88-F260D9590116</RequestId>
</ModifyAuditPolicyResponse>

JSON format

{
	"RequestId":"DC04D812-F18D-4568-9B88-F260D9590116"
}

Error codes

For a list of error codes, visit the API Error Center.