Last active
December 30, 2020 03:55
-
-
Save kaiix/cab8ef6486ee91c1f421 to your computer and use it in GitHub Desktop.
logrotate mongodb log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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