Slow query logs help you find database operations that exceed a latency threshold, so you can target them for index optimization or query rewriting. Use the ApsaraDB for MongoDB console to view, filter, and download these logs.
Slow query log analysis is provided by Database Autonomy Service (DAS), not by the MongoDB instance itself. RAM users need separate DAS permissions to access this feature.
Prerequisites
Before you begin, make sure that you have:
A replica set instance or sharded cluster instance (standalone instances are not supported)
Access to the ApsaraDB for MongoDB console
Limitations
| Limitation | Details |
|---|---|
| Log retention | 7 days; logs cannot be manually deleted |
| Supported instance types | Replica set and sharded cluster only; standalone instances are not supported |
| Regional availability | Not available in all regions; check the console to confirm availability |
View slow query logs
Go to the Replica Set Instances or Sharded Cluster Instances page. Select a resource group and a region, then click the ID of your instance.
In the left-side navigation pane, choose Logs > Slow Query Logs.
Filter the results based on your instance type:
Replica set instance: Filter by database name and time range.
Sharded cluster instance: Filter by database name, shard node, and time range.
To download the displayed logs, click the
icon in the upper-right corner.
Slow operation threshold
An operation is recorded as slow when its execution time exceeds the value of operationProfiling.slowOpThresholdMs (default: 100 ms).
To adjust the threshold, see Set instance parameters.
FAQ
What's next
For detailed slow query log analysis and export options, see Slow query logs.