View and Download MongoDB Logs
On this page
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.
Required 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
.
View and Download Cloud Deployment Logs
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.
To download the logs for a single process in a given cluster using the Atlas UI:
In Atlas, go to the Clusters page for your project.
If it's not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
If it's not already displayed, click Clusters in the sidebar.
The Clusters page displays.
Edit the fields.
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 Valid options are:
| ||||||||||||
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. |
For information on reading MongoDB logs, refer to the Log Messages documentation in the MongoDB manual.
View Local Deployment Logs with the Atlas CLI
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.
Database Access 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.