All Products
Search
Document Center

ApsaraDB for MongoDB:View slow query logs

Last Updated:Jun 14, 2024

You can view the slow query logs of a database in an instance in the ApsaraDB for MongoDB console and analyze the logs to optimize the database.

Prerequisites

  • The instance is a replica set instance or a sharded cluster instance.

  • If the instance was purchased between June 6, 2021 and November 25, 2021, the audit log feature is enabled and slow is selected in the Audit Log Filter Setting panel. For more information about how to enable the audit log feature, see Enable the audit log feature.

    Note

    If only slow is selected in the Audit Log Filter Setting panel, the audit log feature is offered free of charge.

Usage notes

  • The retention period of slow query logs is seven days.

  • Slow query logs cannot be deleted.

  • You cannot view the slow query logs of databases in a standalone instance.

Procedure

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region in which the instance resides. Then, find the instance and click the ID of the instance.

  2. In the left-side navigation pane of the instance details page, choose Logs > Slow Query Logs.

  3. View slow query logs based on the instance architecture.

    • Replica set instances

      Specify the database name and time range to view slow query logs.

    • Sharded cluster instances

      Specify the database name, shard node ID, and time range to view slow query logs.

    Note

    Click Export to download the slow query logs to your on-premises computer.

References

For more information about how to view detailed slow query logs or export slow query logs, see Slow query logs.