Data integration for ApsaraDB for MongoDB
Integrate observable metrics and logs from ApsaraDB for MongoDB into Cloud Monitor 2.0 to monitor your MongoDB instances.
Prerequisites
Activate Managed Service for Prometheus and Hybrid Cloud Monitoring.
You can enable an audit log only for a replica set instance running version 5.0 or earlier and a sharded cluster instance running version 4.2 or earlier. Audit logs are not supported for standalone instances.
Limitations
If you use a RAM user for data integration, grant it the
AliyunCloudMonitorFullAccesssystem policy.Enabling an audit log records all write operations, causing 5% to 15% performance degradation and increased latency jitter. For write-intensive applications, enable this feature only for troubleshooting or security audits.
To modify the log retention period for a Logstore, go to the ApsaraDB for MongoDB console. This setting applies to all instances in the current region. All other settings apply only to the current instance.
You cannot write other data to or modify indexes in a dedicated Logstore, but querying, statistical analysis, and alerting are not restricted.
Billing
Metric integration incurs fees for both real-time export from Hybrid Cloud Monitoring and Managed Service for Prometheus. If you enable second-level monitoring, additional fees apply.
The standard edition of audit logs is billed on a pay-as-you-go basis, based on storage usage and retention period.
After logs are ingested, you are charged by MongoDB for storage, indexing, and traffic that results from log read and write operations.
As of January 6, 2022, the free trial for the ApsaraDB for MongoDB audit log feature has been discontinued. New activations use the standard, pay-as-you-go edition. For more information, see [Notice] ApsaraDB for MongoDB audit logs: Pay-as-you-go now GA, free trials discontinued. After an audit log is sent to Simple Log Service, you cannot pull, consume, deliver, or process the log.
Procedure
Log on to the Cloud Monitor 2.0 console, select your target workspace, and then in the navigation pane, click Integration Center, and then click ApsaraDB for MongoDB.
Create a new policy or select an existing one under Policy name, and then select the Entity Scope.
Select the observable data to integrate, and then click OK.
Observable data
Configuration
MongoDB monitoring metrics
Tag Keys: Specify the instance tag keys to add to your metrics. The corresponding tag key-value pairs are automatically injected as metric labels.
High Resolution Monitoring: Integrates metrics at one-second intervals. Enabled by default.
MongoDB log configuration
Integrating MongoDB logs automatically enables the audit log feature in ApsaraDB for MongoDB. Deleting the integration policy does not automatically disable this feature. You must disable it manually in the ApsaraDB for MongoDB console. For more information, see Disable audit logs.
db: Required Audit Operation Types: Records only requests routed to the current node. Useful for analyzing slow queries and monitoring workloads. Supported operation types:
admin(O&M),slow(slow queries),query,insert,update,delete, andcommand(protocol commands, such as theaggregatemethod).mongos: Required Audit Operation Types: Supported only for sharded cluster instances. Records requests sent to mongos nodes, which may be executed on any database. Useful for auditing operations and tracking traffic. Supported operation types:
admin(O&M),slow(slow queries),query,insert,update, anddelete.
After the integration is complete, view the integrated entities and their observable data in Entity Explorer or Database Observability.
Data storage policy
When you integrate ApsaraDB for MongoDB data, Cloud Monitor creates a Logstore in Simple Log Service and a Prometheus instance to store the data.
Type | Default storage location | Notes |
Metrics | Prometheus instance: RegionShare:{{workspaceName}}:{{regionId}} | None |
Audit log | SLS Project: aliyun-product-data-{{userId}}-{{regionId}} SLS Logstore: mongo_audit_log_standard | None |
Runtime logs and slow query logs | SLS Project: aliyun-product-data-{{userId}}-{{regionId}} SLS Logstore: mongo_slow_run_log | None |
Modify or delete an integration policy
To modify or delete the integration policy for ApsaraDB for MongoDB, go to the Integration Management page in the Integration Center. Find the target policy and click Edit or Delete.