Enables or disables the audit log feature or sets the log retention period for an ApsaraDB for MongoDB instance.

  • 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.

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.

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.

DBInstanceId String Yes dds-bp1785659e3f****

The ID of the instance.

AuditStatus String Yes enable

Specifies whether the audit log feature is enabled. Valid values:

  • enable
  • disabled
StoragePeriod Integer No 30

The log retention period. Valid values: 1 to 365 days. Default value: 30 days.

AuditLogSwitchSource String No Console

The request source for the audit log feature. Set the value to Console.

ServiceType String No Standard

The type of the audit log feature. Valid values:

  • Trail: the free trial edition
  • Standard: the official edition
Note Default value: Trial. Starting from January 6, 2022, the official edition of the audit log feature has been launched in all regions, and new applications for the free trial edition have ended. We recommend that you set this parameter to Standard.

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-bp1785659e3f****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<ModifyAuditPolicyResponse>
    <RequestId>DC04D812-F18D-4568-9B88-F260D9590116</RequestId>
</ModifyAuditPolicyResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

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