Data integration for ApsaraDB for MongoDB

更新时间:
复制 MD 格式

Integrate observable metrics and logs from ApsaraDB for MongoDB into Cloud Monitor 2.0 to monitor your MongoDB instances.

Prerequisites

  • Activate Prometheus Monitoring 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 AliyunCloudMonitorFullAccess system 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

Important

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 Launches Pay-As-You-Go Standard Edition for Audit Logs and Discontinues Free Trial. After an audit log is sent to Simple Log Service, you cannot pull, consume, deliver, or process the log.

Procedure

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

  2. Create a new policy or select an existing one under Policy name, and then select the Entity Scope.

  3. 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, and command (protocol commands, such as the aggregate method).

    • 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, and delete.

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