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

  • This operation is applicable to replica set instances and sharded cluster 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.

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 ModifyAuditPolicy

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

AuditStatus String Yes enable

The status of the audit log. Valid values:

  • enable
  • disabled
DBInstanceId String Yes dds-bpxxxxxxxx

The ID of the instance.

RegionId String No cn-hangzhou

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

StoragePeriod Integer No 30

The retention period of audit logs. Unit: day. Valid values: 1 to 30. Default value: 30.

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.