Docs Menu
Docs Home
/
MongoDB Cloud Manager
/

View, Retrieve, and Manage Logs

On this page

  • MongoDB Real-Time Logs
  • View MongoDB Real-Time Logs
  • Enable or Disable Log Collection for a Deployment
  • Enable or Disable Log Collection for the Project
  • MongoDB On-Disk Logs
  • Configure Log Rotation
  • Agent Logs
  • View Agent Logs
  • Configure Agent Log Rotation

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 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.

1
  1. If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.

    The Deployment page displays.

2

Click the Processes tab for your deployment.

The Processes page displays.

3
4

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.
5
6

The tab displays log information.

7
1
  1. If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.

    The Deployment page displays.

2

Click the Processes tab for your deployment.

The Processes page displays.

3
4
5
  1. Click the Logs tab.

  2. Toggle the Collect Logs For Host to Off or On, as desired.

6

If you turn off log collection, existing log entries remain in the Logs tab, but Cloud Manager does not collect new entries.

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. Next to the Projects menu, expand the Options menu, then click Project Settings.

    The Project Settings page displays.

2

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.

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.

1
  1. If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.

    The Deployment page displays.

2

In the More drop-down list, click MongoDB Log Settings.

3

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.

4

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.

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%.

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.

5

Otherwise, click Cancel and you can make additional changes.

Cloud Manager collects logs for all your MongoDB Agents.

1
  1. If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.

    The Deployment page displays.

2

Click the Agents tab for your deployment.

The Agents page displays.

3

The page displays logs for the type of agent selected in the View drop-down list. The page filters logs according to any filters selected in through the gear icon.

4

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:

  1. In MongoDB Cloud Manager, go to the Deployment page for your project.

    1. If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.

      The Deployment page displays.

  2. Click the Agents tab for your deployment.

    The Agents page displays.

  3. Click All Agents.

  4. Click view logs for the agent.

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:

1
  1. If it is 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 the Deployment page is not already displayed, click Deployment in the sidebar.

    The Deployment page displays.

2

Click the Agents tab for your deployment.

The Agents page displays.

3
4
5

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:

/var/log/mongodb-mms-automation/monitoring-agent.log
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:

%SystemDrive%\MMSAutomation\log\mongodb-mms-automation\monitoring-agent.log
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.

6
7

Otherwise, click Cancel and you can make additional changes.

Back

Prometheus