MongoDB Log File Rotation

1 minute read time.

MongoDB Log File Rotation

Why is it important?

The below benefits are good reasons to consider deploying MongoDB Log file rotation using the script we provide to our Sage X3 Business Partners:-

  1.  Automated Log file rotation offers an easy alternative to using the MongoDB “logrotate” function within a Windows environment.
  2.  Optimizing MongoDB Performance.
  3.  Limiting MongoDB speed issues.
  4.  A backup of the log files is also made for future reference to any issues that may have been captured within the Log files.

 Large MongoDB log files will promote performance degradation inside the SafeX3 Syracuse environment.

 The script we provide here replaces the need to use the MongoDB “logrotate” function.

 “logrotate” may also be implemented by using the below link:-

“logrotate” follows the typical Linux/Unix behavior, and simply

 Closes the log file then reopens a log file with the same name.

The below presentation together with a brief PDF and Supporting Blog

will also be the official documents for distribution of the

X3 MongoDB Log File Rotation solution.

The below URL may be used to set up a normal MongoDB Log file

Rotation using the “logrotate” function


Which Versions of Sage X3 support our MongoDB Script?

This script is compatible with all major versions of Sage X3. It uses 3 simple key arguments to execute and run the script dynamically successfully.


How does it work?

By passing 3 arguments, the Log file Directory path, the Log File Backup Directory Path and the name of the Mongo DB Log file to the script, the configuration is Dynamic.

The MongoDB Log file naming may differ from MongoDB Version to version and where our Sage Business Partners use unique names for the MongoDB Log file.


Automation through the Windows Task Scheduler:-

The script may be fully automated with the Windows Task Scheduler. Any chosen Disaster Recovery plan may be deployed using the Windows Task Scheduler.


Documents and supporting Webinar:-

The script may be downloaded from our FTP Server \\Public\Sage X3\X3 Addons\MongoDB Rotation Script\

This is only accessible to our Sage X3 Business Partners.

Youtube Video:-


X3 MongoDB Log File Rotation PPT.pptx