Last active
August 29, 2015 14:10
-
-
Save gswallow/ce11d2b6d448a79699fe to your computer and use it in GitHub Desktop.
mongodb log rotation with chef
This file contains hidden or 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
logrotate_app node['mongodb']['instance_name'] do | |
frequency 'daily' | |
cookbook 'logrotate' | |
options ['compress', 'dateext', 'missingok', 'notifempty', 'copytruncate'] | |
path node['mongodb']['config']['logpath'] | |
sharedscripts true | |
postrotate %Q!kill -USR1 `cat #{['mongodb']['config']['pidfilepath']} 2> /dev/null` 2> /dev/null || true\nfind `dirname #{node['mongodb']['config']['logpath']}` -type f -regex ".*\\.\\(log.[0-9].*-[0-9].*\\)" -exec rm {} \\; 2> /dev/null || true! | |
rotate 30 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment