Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Created August 25, 2011 11:34
Show Gist options
  • Save kwilczynski/1170477 to your computer and use it in GitHub Desktop.
Save kwilczynski/1170477 to your computer and use it in GitHub Desktop.
Logrotate configuration for MongoDB
/var/log/mongodb/mongodb.log
{
daily
rotate 7
copytruncate
notifempty
missingok
compress
sharedscripts
postrotate
MONGOD_LOCK='/var/lib/mongodb/mongod.lock'
MONGOD_LOG_FILES='/var/log/mongodb/mongodb.log.????-??-??T??-??-??'
[ -x $MONGOD_LOCK ] || exit 0
/bin/kill -SIGUSR1 $( /bin/cat $MONGOD_LOCK 2> /dev/null ) 2> /dev/null || true
/bin/rm -f $MONGOD_LOG_FILES
endscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment