Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mongodb logrotate on Ubuntu
# Put this in /etc/logrotate.d/mongodb
# http://stackoverflow.com/questions/5004626/mongodb-log-file-growth
/var/log/mongo/*.log {
daily
rotate 30
compress
dateext
missingok
notifempty
sharedscripts
postrotate
/bin/kill -SIGUSR1 `cat /var/lib/mongo/mongod.lock 2> /dev/null` 2> /dev/null || true
endscript
}
@fdrouet
Copy link

fdrouet commented Jun 5, 2013

on ubuntu 12.04 with mongodb 2.4.3 you should change your path for the logs and lock files :

- /var/log/mongo/*.log {
+ /var/log/mongodb/*.log {

...

-   /bin/kill -SIGUSR1 `cat /var/lib/mongo/mongod.lock 2> /dev/null` 2> /dev/null || true
+   /bin/kill -SIGUSR1 `cat /var/lib/mongodb/mongod.lock 2> /dev/null` 2> /dev/null || true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment