Skip to content

Latest commit

 

History

History
118 lines (85 loc) · 4.53 KB

README.md

File metadata and controls

118 lines (85 loc) · 4.53 KB

logrotate Cookbook

Cookbook Version CI State OpenCollective OpenCollective License

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/.

Maintainers

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.

Requirements

Platforms

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

  • Chef 15.3+

Resources

Usage

Package Installation

By default, the cookbook will install the logrotate package:

logrotate_package 'logrotate'

Global Configuration

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

Application-Specific Configuration

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

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website