You can view the slow query logs of a database in the ApsaraDB for MongoDB console
and analyze the logs to optimize the database.
Prerequisites
The instance is of the
General-purpose Local-disk and
Dedicated Local-disk type.
Note You can view the instance type in the Instance type column.
Precautions
The retention period for slow query logs is 72 hours.
Procedure
- Log on 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 to which
the instance belongs.
- Click the ID of an instance, or click
in the Actions column corresponding to the instance and select Manage.
- In the left-side navigation pane of the instance details page, choose .
- View slow query logs based on the instance type.
- Replica set instance
Specify the database name and time range to view slow query logs.

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