The default install for Mongodb does not configure log rotation.
In /etc/logrotate.d/mongod
/var/log/mongodb/*.log {
daily
rotate 30
compress
dateext
missingok
notifempty
sharedscripts
postrotate
/bin/kill -SIGUSR1 `cat /media/data/mongodb/mongod.lock 2> /dev/null` 2> /dev/null || true
endscript
- Rotate logs daily
- Delete log files older than 30 days
- Compress the log files
- Use YYYYMMDD for the archive extension
- Don't fail if there is no log file
- Don't archive empty log files
- Only run postrotate script once, even if multiple files are present
- Signal to Mongo that we are writing to a new log file. Apparently, mongo will continue to write to the old log file if you do not signal. The cat command is used to obtain the PID for the mongod process.
http://stackoverflow.com/questions/5004626/mongodb-log-file-growth http://docs.mongodb.org/manual/tutorial/rotate-log-files/
Did you miss to close the bracket on the script?