Manages the logrotate package and provides a resource to manage application specific logrotate configuration.
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.
Should work on any platform that includes a 'logrotate' package and writes logrotate configuration to /etc/logrotate.d.
Tested on:
The package resource will ensure logrotate is always up to date by default.
To create application specific logrotate configs, use the logrotate_app
resource. For example, to rotate logs for a tomcat application named myapp that writes its log file to /var/log/tomcat/myapp.log
:
logrotate_app 'tomcat-myapp' do
path '/var/log/tomcat/myapp.log'
frequency 'daily'
rotate 30
create '644 root adm'
end
To rotate multiple logfile paths, specify the path as an array:
logrotate_app 'tomcat-myapp' do
path ['/var/log/tomcat/myapp.log', '/opt/local/tomcat/catalina.out']
frequency 'daily'
create '644 root adm'
rotate 7
end
To specify which logrotate options, specify the options as an array:
logrotate_app 'tomcat-myapp' do
path '/var/log/tomcat/myapp.log'
options ['missingok', 'delaycompress', 'notifempty']
frequency 'daily'
rotate 30
create '644 root adm'
end
This project exists thanks to all the people who contribute.
Thank you to all our backers!
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.