Navigation

View, Retrieve, and Manage Logs

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 and mongos 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 :ref:` individual MongoDB deployments <toggle-log-collection-for-deployment>`. If you disable log collection, Cloud Manager continues to display previously collected log entries.

View MongoDB Real-Time Logs

1

Click Deployment, then the Processes tab, then the Topology view.

2

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

On the line listing the process, click Metrics.

4

Click the Logs tab.

The tab displays log information. If the tab is not displayed, see Enable or Disable Log Collection for a Deployment to enable log collection.

5

Refresh the browser window to view updated entries.

Enable or Disable Log Collection for a Deployment

1

Click Deployment, then the Processes tab, then the Topology view.

2

On the line for any process, click the ellipsis [] icon then click Monitoring Settings.

3

Toggle Collect Logs For Host as desired.

  1. Click the Logs tab.
  2. Toggle the Collect Logs For Host to Off or On, as desired.
4

Click X to close the Monitoring Settings box.

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

Enable or Disable Log Collection for the Project

1

Click Settings, then Project Settings.

2

Toggle the Collect Logs For All Hosts option to Yes or No, as desired.

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.

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

Ops Manager can rotate then compress logs for clusters that the MongoDB Agent manages. If the MongoDB Agent only monitors a cluster, it ignores that cluster’s logs.

Note

When using this feature, disable any platform-based log-rotation services like logrotate. If the MongoDB Agent only monitors the cluster, that cluster may use platform-based services.

1

Open the MongoDB Log Settings modal.

  1. Click Deployment.
  2. In the More drop-down list, click MongoDB Log Settings.
2

Configure the log rotation settings.

Cloud Manager rotates the server logs on your MongoDB hosts per the following settings:

Field Necessity Action Default
Rotate Logs Required Cloud Manager rotates its logs if you set this toggle to On. Set to Off if you don’t want Cloud Manager to rotate its logs. Off
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. Cloud Manager doesn’t compress log files if you leave this text box empty. 0
Max Percent of Disk Optional Log files can take up to this percent of disk space on your MongoDB host’s log volume. Ops Manager deletes the oldest log files once they exceed this disk threshold. 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.

3

Click Review & Deploy to review your changes.

4

Click Confirm & Deploy to deploy your changes.

Otherwise, click Cancel and you can make additional changes.

Agent Logs

Cloud Manager collects logs for all your MongoDB Agents.

View Agent Logs

1

Click Deployment, then the Agents tab, then Agent Logs.

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.

2

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 click the Agents tab’s All Agents list and then 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:

1

Click Deployment, then the Agents tab.

2

Click Downloads & Settings.

3

Scroll down to the Agent Log Settings section.

4

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:

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

5

Click Review & Deploy to review your changes.

6

Click Confirm & Deploy to deploy your changes.

Otherwise, click Cancel and you can make additional changes.