View, Retrieve, and Manage Logs
On this page
- OAuth 2.0 authentication for programmatic access to Cloud Manager is available as a Preview feature.
- The feature and the corresponding documentation might change at any time during the Preview period. To use OAuth 2.0 authentication, create a service account to use in your requests to the Cloud Manager Public API.
Cloud Manager collects log information for both MongoDB processes and its agents. For MongoDB processes, you can access both real-time logs and on-disk logs.
The MongoDB logs provide the diagnostic logging information for your
mongod
andmongos
processes.The Agent logs provide insight into the behavior of your Cloud Manager agents.
MongoDB Real-Time Logs
The MongoDB Agent issues the getLog
command with every
monitoring ping. This command collects log entries from RAM cache of
each MongoDB process.
Cloud Manager enables real-time log collection by default. You can disable log collection for either all MongoDB deployments in a Cloud Manager project or for individual MongoDB deployments. If you disable log collection, Cloud Manager continues to display previously collected log entries.
View MongoDB Real-Time Logs
In MongoDB Cloud Manager, go to the Deployment page for your project.
If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.
The Deployment page displays.
Go to the Processes page.
Click the Processes tab for your deployment.
The Processes page displays.
(Optional) For sharded clusters, filter which process type is listed.
The four buttons are listed in the following order, left to right: Shards, Configs, Mongos, and BIs.
Process | Displays |
---|---|
Shards | mongod processes that host your data. |
Configs | mongod processes that run as config
servers to store a sharded cluster's metadata. |
Mongos | mongos processes that route data in a sharded
cluster. |
BIs | BI processes that access data
in a sharded cluster. |
Enable or Disable Log Collection for a Deployment
In MongoDB Cloud Manager, go to the Deployment page for your project.
If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.
The Deployment page displays.
Go to the Processes page.
Click the Processes tab for your deployment.
The Processes page displays.
Enable or Disable Log Collection for the Project
In MongoDB Cloud Manager, go to the Project Settings page.
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.
Next to the Projects menu, expand the Options menu, then click Project Settings.
The Project Settings page displays.
MongoDB On-Disk Logs
Cloud Manager collects on-disk logs even if the MongoDB instance is not
running. The MongoDB Agent collects the logs from the location you
specified in the MongoDB systemLog.path
configuration option. The
MongoDB on-disk logs are a subset of the real-time logs and therefore
less verbose.
Note
This option isn't available for deployed MongoDB processes if the
systemLog.destination
property is set to syslog
.
You can configure log rotation for the on-disk logs. Cloud Manager rotates logs by default.
This procedure rotates both system and audit logs for Cloud Manager.
Configure Log Rotation
Cloud Manager can rotate and compress logs for clusters that the MongoDB Agent manages. If the MongoDB Agent only monitors a cluster, it ignores that cluster's logs.
Important
If you're running MongoDB Enterprise version 5.0 or later and MongoDB Agent 11.11.0.7355 or later, you can:
Set separate rules for rotating server logs and audit logs.
Compress and delete audit logs using Cloud Manager. For security reasons, we recommend managing your audit log compression and deletion outside of Cloud Manager.
If you're running earlier versions of MongoDB Enterprise or the MongoDB Agent, Cloud Manager:
Uses your System Log Rotation settings to rotate both the server logs and the audit logs.
Doesn't compress or delete audit logs. If you configure compression and deletion, Cloud Manager applies these settings to the server logs only.
MongoDB Community users can rotate, compress, and delete the server logs only.
Note
When you use this feature, disable any platform-based log-rotation
services like logrotate
. Remove the reopen
and rename
flags from the process configuration files. If the MongoDB Agent only
monitors the cluster, that cluster may use platform-based services.
In MongoDB Cloud Manager, go to the Deployment page for your project.
If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.
The Deployment page displays.
Enable log rotation.
Toggle System Log Rotation to ON to rotate server logs.
MongoDB Enterprise users running MongoDB Enterprise version 5.0 or later and MongoDB Agent 11.11.0.7355 and later can also toggle Audit Log Rotation to ON to rotate audit logs and configure audit log rotation separately.
If you're running earlier versions of MongoDB Enterprise or the MongoDB Agent, setting System Log Rotation to ON also rotates audit logs.
Set log rotation to OFF if you don't want Cloud Manager to rotate its logs. Log rotation is OFF by default.
After you enable log rotation, Cloud Manager displays additional log rotation settings.
Configure the log rotation settings.
Cloud Manager rotates the logs on your MongoDB hosts per the following settings:
Field | Necessity | Action | Default |
---|---|---|---|
Size Threshold (MB) | Required | Cloud Manager rotates log files that exceed this maximum log file
size. | 1000 |
Time Threshold (Hours) | Required | Cloud Manager rotates logs that exceed this duration. | 24 |
Max Uncompressed Files | Optional | Log files can remain uncompressed until they exceed this number of files. Cloud Manager compresses the oldest log files first. If you leave this setting empty, Cloud Manager will use the default
of | 5 |
Max Percent of Disk | Optional | Log files can take up to this percent of disk space on your MongoDB host's log volume. Cloud Manager deletes the oldest log files once they exceed this disk threshold. If you leave this setting empty, Cloud Manager will use the default of
| 2% |
Total Number of Files | Optional | Total number of log files. If a number is not specified, the
total number of log files defaults to 0 and is determined
by other Rotate Logs settings. | 0 |
When you are done, click Save to review your changes.
Agent Logs
Cloud Manager collects logs for all your MongoDB Agents.
View Agent Logs
In MongoDB Cloud Manager, go to the Deployment page for your project.
If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.
The Deployment page displays.
Go to the Agents page.
Click the Agents tab for your deployment.
The Agents page displays.
Filter the log entries.
To display logs for a different type of agent, use the View drop-down list.
To display logs for a specific hosts or MongoDB processes, click the gear icon and make your selections.
To clear filters, click the gear icon and click Remove Filters.
To download the selected logs, click the gear icon and click Download as CSV File.
Note
To view logs for a specific agent, you can alternatively:
In MongoDB Cloud Manager, go to the Deployment page for your project.
If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.
The Deployment page displays.
Click the Agents tab for your deployment.
The Agents page displays.
Click All Agents.
Click view logs for the agent.
Configure Agent Log Rotation
If you use Automation to manage your cluster, follow this procedure to configure rotation of the Agent log files.
Note
If you haven't enabled Automation, see the following documentation for information about how to manually configure logging settings in the agent configuration files:
In MongoDB Cloud Manager, go to the Deployment page for your project.
If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.
The Deployment page displays.
Go to the Agents page.
Click the Agents tab for your deployment.
The Agents page displays.
Edit the log settings.
Click the pencil icon to edit the Monitoring Agent or Backup Agent log settings:
Name | Type | Description | |
---|---|---|---|
Linux Log File Path | string | Conditional: Logs on a Linux host. The path to which the agent writes its logs on a Linux host. The suggested value is:
| |
Windows Log File Path | string | Conditional: Logs on a Windows host. The path to which the agent writes its logs on a Windows host. The suggested value is:
| |
Rotate Logs | Toggle | A toggle to select if the logs should be rotated. | |
Size Threshold (MB) | integer | The size where the logs rotate automatically. The default value
is 1000 . | |
Time Threshold (Hours) | integer | The duration of time when the logs rotate automatically. The
default value is 24 . | |
Max Uncompressed Files | integer | Optional. The greatest number of log files, including the
current log file, that should stay uncompressed. The suggested
value is 5 . | |
Max Percent of Disk | integer | Optional. The greatest percentage of disk space on your
MongoDB hosts that the logs should consume. The suggested
value is 2% . | |
Total Number of Files | integer | Optional. The total number of log files. If a number is not specified,
the total number of log files defaults to 0 and is determined by other
Rotate Logs settings. |
When you are done, click Save.