Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guideDeveloper guideAdmin guide
Company siteHelp center
English
  • Русский
  • English
v73
  • v74
  • v73
  • v72
Login
  • Getting Started
  • Administrator documentation
  • Functional characteristics
  • Technology description
  • System requirements
  • Admin Panel
  • Platform installation
  • Platform configuration
    • Configuration file
    • Domain settings
    • LDAP access configuration
    • Sending Email via SMTP relay
    • Pixel and push domain configuration
    • Cluster and Replication Setup
    • System notifications configuration
    • Processes UNIX sockets configuration
    • HTTPS Configuration
    • External SQL database integration
    • Adding sender IP addresses
    • Deduplication request settings
    • PostgreSQL database for account data
    • Proxy server settings
    • Getting HTTP service statuses
    • Configuration MongoDB logs rotation
    • Configuration of system constants and directories
  • Platform maintenance
  • Custom channels guide
  • Extra
  • Processing HTTP/HTTPS traffic
  • Administrator API
This is documentation for Altcraft Platform v73. This documentation is no longer maintained.
The information for up-to-date platform version at this page is available (v74).
  • Platform configuration
  • Configuration MongoDB logs rotation
Documentation for version v73

Configuration MongoDB logs rotation

Log files are critical for analyzing errors encountered when executing platform processes. However, outdated logs can take up a significant amount of memory on the server. In order for the system to clean them regularly, it is necessary to configure log rotation. In this article we will describe log rotation for MongoDB.

To configure rotation using the logrotate utility, create the /etc/logrotate.d/mongod file with the following contents:

/var/log/mongodb/*.log {
size 100M
rotate 7
compress
missingok
notifempty
sharedscripts
copytruncate
postrotate
/bin/kill -SIGUSR1 $(cat /var/lib/mongodb/mongod.lock 2> /dev/null) 2> /dev/null || true
endscript
}
note

When installing MongoDB from a deb package, the above file is created automatically. You can edit it to customize the rotation to your liking.

The main parameters of the script:

  • size - the size above which the file will be rotated at the next logrotate startup
  • rotate - number of saved file rotations
  • compress - old versions of log files will be compressed with gzip
  • notifempty - do not save the log file in rotation if it is empty

Above is the recommended configuration of the utility, you can customize it as you wish. All possible parameters are listed on this page.

Last updated on Jun 30, 2025
Previous
Getting HTTP service statuses
Next
Configuration of system constants and directories
© 2015 - 2025 Altcraft, LLC. All rights reserved.