ApsaraDB for MongoDB audit logs support multiple operation types. You can audit only the operation types you need to reduce log volume and costs.
Prerequisites
The audit log feature is enabled. For instructions, see Enable audit logs for DAS Enterprise Edition (NoSQL compatible).
Impact
After you stop auditing a specific operation type, the system no longer records that type. Existing logs are not affected and remain available for queries. For more information, see Query audit logs for DAS Enterprise Edition (NoSQL compatible).
Procedure
-
Sign in to the ApsaraDB for MongoDB console.
-
In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances based on the instance type.
-
In the upper-left corner of the page, select the resource group and region for your instance.
-
Find your target instance and click its ID, or click Manage in the Actions column.
-
In the left-side navigation pane of the instance details page, click .
-
In the upper-left corner of the page, click Audit Settings. In the dialog box that appears, select the operation types to audit, and then click OK.
-
db: Records only the requests routed to the current node. Useful for analyzing slow queries and monitoring workloads. The following table describes the supported operation types.
Operation type
Description
admin
Administrative operations.
slow
Slow queries.
query
Query operations.
insert
Insert operations.
update
Update operations.
delete
Delete operations.
command
Protocol commands, such as the
aggregatemethod. -
mongos: Records requests sent to a mongos node, which may target any database in the cluster. Useful for traffic statistics and general auditing. The following table describes the supported operation types.
Operation type
Description
admin
Administrative operations.
slow
Slow queries.
insert
Insert operations.
update
Update operations.
delete
Delete operations.
-
-
In the upper-left corner of the page, click Service Settings. In the dialog box that appears, modify the retention period for your audit logs, and then click Submit.
-
SQL Log Storage Duration (Cold Storage Duration): Sets the retention period for cold storage. Valid values are 30, 180, 365, 1095, and 1825 days.
-
Hot Storage Duration: Sets the retention period for hot storage. The valid range is 1 to 7 days.
-
-
Click OK.
Related APIs
|
API |
Description |
|
Modifies the audit operation types for an ApsaraDB for MongoDB instance. |
|
|
Queries the audit operation types for an ApsaraDB for MongoDB instance. |
|
|
Enables or configures DAS Enterprise Edition (NoSQL compatible). |