Skip to content

Instantly share code, notes, and snippets.

@kaiix
Last active December 30, 2020 03:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaiix/cab8ef6486ee91c1f421 to your computer and use it in GitHub Desktop.
Save kaiix/cab8ef6486ee91c1f421 to your computer and use it in GitHub Desktop.
logrotate mongodb log
/var/log/mongodb/mongod.log {
hourly
missingok
rotate 5
compress
delaycompress
notifempty
create 0640 mongodb mongodb
sharedscripts
postrotate
[ -s /var/lib/mongodb/mongod.lock ] && /bin/kill -USR1 `cat /var/lib/mongodb/mongod.lock`
find /var/log/mongodb/ -type f -regex ".*\.\(log.[0-9].*-[0-9].*\)" -exec rm {} \;
endscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment