View and Download MongoDB Logs (original) (raw)
Each mongod, mongos, andmongosqld instance keeps an account of its activity in its own log file. Atlas retains the last 30 days of log messages andsystem 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, Flex cluster, and M2/M5
Shared clusters (deprecated) don't provide downloadable logs.
To learn about recommendations for auditing and logging, including the events that we recommend auditing, seeRecommendations for Atlas Auditing and Logging in the Atlas Architecture Center.
To download database access logs, you must have at leastProject 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.
To download the logs for a single process in a given cluster using the Atlas UI:
Warning
Navigation Improvements In Progress
We're currently rolling out a new and improved navigation experience. If the following steps don't match your view in the Atlas UI, see the preview documentation.
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.Click the ellipsis icon (
...
) next to the cluster that contains themongod
instance whose logs you want to download.Select Download Logs.
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:OptionDescriptionmongodDatabase server logs.mongod-audit-logDatabase auditing logs. Note: this option only appears if you have database auditing enabled for your cluster.mongosmongos logs. Note: this option only appears if your cluster is sharded.mongos-audit-logmongos auditing logs. Note: this option only appears if your sharded cluster has auditing enabled.mongosqldBI 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 selectCustom 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 theLog 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
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.