Enables or disables the audit log feature and specifies a retention period for audit logs.

Before you call this operation, make sure that you understand the billing methods and pricing of audit logs.

Before you call this operation, make sure that the ApsaraDB for Redis instance meets the following requirements:

  • The instance is an instance of ApsaraDB for Redis Community Edition or a performance-enhanced instance of ApsaraDB for Redis Enhanced Edition (Tair). For more information, see Performance-enhanced instances.
  • The major version of the ApsaraDB for Redis instance is Redis 4.0 or later, and the latest minor version is used. You can call the DescribeEngineVersion operation to query the major version and minor version of an ApsaraDB for Redis instance.

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 ModifyAuditLogConfig

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

InstanceId String Yes r-bp1zxszhcgatnx****

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

RegionId String No cn-hangzhou

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

DbAudit Boolean No true

Specifies whether to enable the audit log feature. Default value: true. Valid values:

  • true: enables the audit log feature.
  • false: disables the audit log feature.
Note If the instance runs in the cluster architecture or read/write splitting architecture, the audit logs of data nodes and proxy nodes are both enabled or disabled at the same time. You cannot separately enable the audit logs of data nodes or proxy nodes. For more information, see Cluster master-replica instances or Read/write splitting instances.
Retention Integer No 10

The retention period of audit logs. Valid values: 1 to 365. Unit: days.

Note
  • This parameter is required only when the DbAudit parameter is set to true.
  • The value of this parameter takes effect for all ApsaraDB for Redis instances in the current region.

Response parameters

Parameter Type Example Description
RequestId String 8D0C0AFC-E9CD-47A4-8395-5C31BF9B****

The ID of the request.

Examples

Sample requests

https://r-kvstore.aliyuncs.com/?Action=ModifyAuditLogConfig
&InstanceId=r-bp1zxszhcgatnx****
&DbAudit=true
&Retention=10
&<Common request parameters>

Sample success responses

XML format

<ModifyAuditLogConfigResponse>
      <RequestId>8D0C0AFC-E9CD-47A4-8395-5C31BF9B****</RequestId>
</ModifyAuditLogConfigResponse>

JSON format

{
    "RequestId":"8D0C0AFC-E9CD-47A4-8395-5C31BF9B****"
}

Error codes

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