All Products
Search
Document Center

ApsaraDB for MongoDB:Change the retention period for audit logs

Last Updated:Aug 20, 2026

The audit log feature is a pay-as-you-go service that is billed based on storage usage and the retention period. To change the retention period for all ApsaraDB for MongoDB instances in a specific region, use the ApsaraDB for MongoDB console. This topic describes how to change the audit log retention period.

Precautions

  • The retention period applies to all instances in the selected region. Confirm this change is appropriate for all of them before you proceed.

  • Audit logs are billed on a pay-as-you-go basis based on storage usage and the retention period. To avoid unnecessary costs, set a retention period that meets your business requirements.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.

  2. Based on the instance type, click Replica Set Instances or Sharded Cluster Instances in the left-side navigation pane.

  3. In the upper-left corner of the page, select the resource group and region of the target instance.

  4. Find the target instance and click its ID, or click Manage in the Actions column.

  5. In the left-side navigation pane, click Data Security > Audit Logs.

  6. In the upper-right corner of the page, click Service Settings.

  7. In the Global Settings section of the Service Settings panel, change the retention period.

    Important
    • This setting applies to all instances in the selected region.

    • To avoid unnecessary costs, set a retention period that meets your business requirements.

  8. Click Confirm.

Related APIs

API

Description

ModifyAuditPolicy

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