Manages the logrotate package and provides resources to manage both global and application-specific logrotate configurations. This cookbook allows you to manage the logrotate package installation and create configuration for both the main logrotate.conf file and application-specific configurations in /etc/logrotate.d/.
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:
- Ubuntu / Debian
- CentOS
- Amazon Linux
- openSUSE Leap
- Chef 15.3+
- logrotate_app - Manages application-specific logrotate configurations
- logrotate_global - Manages the global logrotate configuration
- logrotate_package - Manages the logrotate package installation
By default, the cookbook will install the logrotate package:
logrotate_package 'logrotate'
To manage the global logrotate configuration:
logrotate_global 'logrotate' do
options %w(weekly dateext)
parameters(
'rotate' => 4,
'create' => nil
)
paths(
'/var/log/wtmp' => {
'missingok' => true,
'monthly' => true,
'create' => '0664 root utmp',
'rotate' => 1
}
)
end
To create application-specific logrotate configs, use the logrotate_app
resource:
logrotate_app 'tomcat-myapp' do
path '/var/log/tomcat/myapp.log'
frequency 'daily'
rotate 30
create '644 root adm'
options %w(missingok compress delaycompress copytruncate notifempty)
end
For multiple log files:
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
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.