For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

View and Download MongoDB Logs

Important

The feature described on this page is not currently supported on Atlas Infinite clusters during public preview. For the features supported in public preview, see Public Preview Availability.

Each mongod and mongos instance keeps an account of its activity in its own log file. Atlas retains the last 30 days of log messages and system event audit messages. The Performance Advisor retains at most 7 days of logs. If you terminate a cluster, the logs that cluster generated persist, and you can download these logs at any point until the end of their retention periods if you have the Project Cluster Log Viewer access.

Note

Note

Free clusters (formerly known as M0) and Flex cluster don't provide downloadable logs.

To learn about recommendations for auditing and logging, including the events that we recommend auditing, see Guidance for Atlas Auditing and Logging in the Atlas Architecture Center.

To download database access logs, you must have at least Project Database Access Admin access.

To download logs, you must have Project Data Access Read Only access or higher to the project. Users with Organization Owner access must add themselves to the project as a Project Owner.

To download a zipped file containing the logs for the selected hostname using the Atlas CLI, run the following command:

atlas logs download <hostname> <mongodb.gz|mongos.gz|mongosqld.gz|mongodb-audit-log.gz|mongos-audit-log.gz> [options]

To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas logs download.

For information on reading MongoDB logs, refer to the Log Messages documentation in the MongoDB manual.

To view the logs for a deployment using the Atlas CLI, run the following command:

atlas deployments logs [options]

To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas deployments logs.

Note

This feature is available for M10 clusters or higher. To learn more about which features are available for Free clusters, see Atlas Free Cluster Limits, and for Flex clusters, see Atlas Flex Limitations.

You can view authentication attempts that were made against your cluster. Both successful and unsuccessful attempts are logged, including the timestamp of the attempt and which user tried to authenticate.