Automatic rotation for mongodb.log should be done based on size, and the number of backups retained should be capped at a configurable limit. Reasonable defaults might be 20MB size and 3 backups. That way the total disk space used to keep log files will have a configured maximum.
Suggested example syntax for /etc/mongodb.conf:
I have filed this as Major priority because it can impact a running server as a secondary problem. Due to an unrelated issue my Mongo server started logging the same error message repeatedly and quickly filled up its filesystem. Had this feature been in place, with size-based rotation and a fixed number of backups, the filesystem would not have filled up.
- is duplicated by
SERVER-13193 Logs should rotate without an external trigger
- is related to
SERVER-4499 without --logappend, rotate old log
- related to
SERVER-4905 logRotate should conform to standard log rotation mechanisms