Docs Menu
Docs Home
/
MongoDB Atlas
/

View and Download MongoDB Logs

On this page

  • Required Access
  • View and Download Cloud Deployment Logs
  • View Local Deployment Logs with the Atlas CLI
  • Database Access Logs

Each mongod, mongos, and mongosqld 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.

Note

M0 Free clusters and M2/M5 Shared clusters do not provide downloadable logs.

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.

Tip

See: Related Links

To download the logs for a single process in a given cluster using the Atlas UI:

1
  1. If it's not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your desired project from the Projects menu in the navigation bar.

  3. If it's not already displayed, click Clusters in the sidebar.

    The Clusters page displays.

2
  1. Click the ellipsis icon (...) next to the cluster that contains the mongod instance whose logs you want to download.

  2. Select Download Logs.

3

In the Download Logs dialog box, edit the following fields:

Field
Content
Select process

Select the process for which you want logs. For clusters where the only log type available is mongod, Atlas does not display this field.

Valid options are:

Option
Description
mongod
Database server logs.
mongod-audit-log
Database auditing logs. Note: this option only appears if you have database auditing enabled for your cluster.
mongos
mongos logs. Note: this option only appears if your cluster is sharded.
mongos-audit-log
mongos auditing logs. Note: this option only appears if your sharded cluster has auditing enabled.
mongosqld
BI Connector logs. Note: this option only appears if you have BI Connector enabled for your cluster.
Select server
Select the server in the cluster whose logs you want to retrieve.
Time Period

Select the time frame of log activity to return. If you select Custom Time, specify the inclusive start and end time of log activity to return. The start time must be less than 30 days ago.

IMPORTANT: To ensure that your log data returns within the desired time frame, set the time zone in your Atlas project settings.

4

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 not available for M0 Free clusters, M2, and M5 clusters. To learn more about which features are unavailable, see Atlas M0 (Free Cluster), M2, and M5 Limits.

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.

Back

Prometheus