Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

logrotate (48) Versions 2.2.0

Installs logrotate package and provides a resource for managing logrotate configs

Policyfile
Berkshelf
Knife
cookbook 'logrotate', '= 2.2.0', :supermarket
cookbook 'logrotate', '= 2.2.0'
knife supermarket install logrotate
knife supermarket download logrotate
README
Dependencies
Changelog
Quality 67%

logrotate Cookbook

Build Status

Manages the logrotate package and provides a definition to manage
application specific logrotate configuration.

Requirements

Platforms

Should work on any platform that includes a 'logrotate' package and
writes logrotate configuration to /etc/logrotate.d. Tested on Ubuntu
and Centos.

Chef

  • Chef 12.5+

Cookbooks

  • none

Recipes

global

Generates and controls a global /etc/logrotate.conf file that will
include additional files generated by the logrotate_app definition
(see below). The contents of the configuration file is controlled
through node attributes under node['logrotate']['global']. The
default attributes are based on the configuration from the Ubuntu
logrotate package.

To define a valueless directive (e.g. compress, copy) simply add
an attribute named for the directive with a truthy value:

node['logrotate']['global']['compress'] = 'any value here'

Note that defining a valueless directive with a falsey value will not
make it false, but will remove it:

# Removes a defaulted 'compress' directive; does not add a 'nocompress' directive.
node.override['logrotate']['global']['compress'] = false

To fully override a booleanish directive like compress, you should
probably remove the positive form and add the negative form:

node.override['logrotate']['global']['compress'] = false
node.override['logrotate']['global']['nocompress'] = true

The same is true of frequency directives; to be certain the frequency
directive you want is included in the global configuration, you should
override the ones you don't want as false:

%w[ daily weekly yearly ].each do |freq|
  node.override['logrotate']['global'][freq] = false
end
node.override['logrotate']['global']['monthly'] = true

To define a parameter with a value (e.g. create, mail) add an
attribute with the desired value:

node['logrotate']['global']['create'] = '0644 root adm'

To define a path stanza in the global configuration (generally
unneeded because of the logrotate_app definition) just add an
attribute with the path as the name and a hash containing directives
and parameters as described above:

node['logrotate']['global']['/var/log/wtmp'] = {
  'missingok' => true,
  'monthly'   => true,
  'create'    => '0660 root utmp',
  'rotate'    => 1
}

firstaction, prerotate, postrotate, and lastaction scripts can
be defined either as arrays of the lines to put in the script or
multiline strings:

node['logrotate']['global']['/var/log/foo/*.log'] = {
  'missingok'  => true,
  'monthly'    => true,
  'create'     => '0660 root adm',
  'rotate'     => 1,
  'prerotate'  => ['service foo start_rotate', 'logger started foo service log rotation'],
  'postrotate' => <<-EOF
    service foo end_rotate
    logger completed foo service log rotation
  EOF
}

Resources

logrotate_app

This resource can be used to drop off customized logrotate config
files on a per application basis.

The resource takes the following properties:

  • path: specifies a single path (string) or multiple paths (array)
    that should have logrotation stanzas created in the config file. No
    default, this must be specified.

  • cookbook: The cookbook that continues the template for
    logrotate_app config definitions. By default this is logrotate.
    Users can provide their own template by setting this attribute to
    point at a different cookbook.

  • template_name: sets the template source, default is
    "logrotate.erb".

  • template_mode: the mode to create the logrotate template with
    (default: "0644")

  • template_owner: the owner of the logrotate template (default:
    "root")

  • template_group: the group of the logrotate template (default:
    "root")

  • frequency: sets the frequency for rotation. Default value is
    'weekly'. Valid values are: hourly, daily, weekly, monthly, yearly,
    see the logrotate man page for more information. Note that usually
    logrotate is configured to be run by cron daily. You have to change
    this configuration and run logrotate hourly to be able to really
    rotate logs hourly. Hourly rotation requires logrotate v3.8.5 or
    higher.

  • options: Any logrotate configuration option that doesn't specify a
    value. See the logrotate(8) manual page of v3.9.2 or earlier for
    details.

In addition to these properties, any logrotate option that takes a
parameter can be used as a logrotate_app property. For example, to set
the rotate option you can use a resource declaration such as:

logrotate_app 'tomcat-myapp' do
  path      '/var/log/tomcat/myapp.log'
  frequency 'daily'
  rotate    30
  create    '644 root adm'
end

See the logrotate(8) manual page of v3.9.2 or earlier for the list of
available options.

Usage

The default recipe will ensure logrotate is always up to date.

To create application specific logrotate configs, use the
logrotate_app definition. 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

License & Authors

Copyright 2009, Scott M. Likens
Copyright 2011-2012, Chef Software, Inc.
Copyright 2016, Steven Danna

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

apache2 Applicable Versions
apache_spark Applicable Versions
apache_spark_ng Applicable Versions
application_ruby Applicable Versions
askbot Applicable Versions
atop Applicable Versions
autopatch_ii Applicable Versions
baragon Applicable Versions
baseserver Applicable Versions
bd_nxlog Applicable Versions
cerner_kafka Applicable Versions
cerner_tomcat Applicable Versions
chef-client Applicable Versions
chef-client 3.1.0
chef-client 3.1.2
chef-client 3.2.0
chef-client 3.2.2
chef-client 3.3.0
chef-client 3.3.2
chef-client 3.3.3
chef-client 3.3.4
chef-client 3.3.6
chef-client 3.3.8
chef-client 3.4.0
chef-client 3.5.0
chef-client 3.5.2
chef-client 3.6.0
chef-client 3.7.0
chef-client 3.8.0
chef-client 3.8.1
chef-client 3.8.2
chef-client 3.9.0
chef-client 4.0.0
chef-client 4.1.0
chef-client 4.1.1
chef-client 4.2.0
chef-client 4.2.1
chef-client 4.2.2
chef-client 4.2.3
chef-client 4.2.4
chef-client 4.3.0
chef-client 4.3.1
chef-client 4.3.2
chef-client 4.3.3
chef-client 4.4.0
chef-client 4.5.0
chef-client 4.5.1
chef-client 4.5.2
chef-client 4.5.3
chef-client 4.5.4
chef-client 4.6.0
chef-client 5.0.0
chef-client 6.0.0
chef-client 7.0.0
chef-client 7.0.1
chef-client 7.0.2
chef-client 7.0.3
chef-client 7.1.0
chef-client 7.2.0
chef-client 7.2.1
chef-client 8.0.0
chef-client 8.0.1
chef-client 8.0.2
chef-client 8.1.0
chef-client 8.1.1
chef-client 8.1.2
chef-client 8.1.3
chef-client 8.1.4
chef-client 8.1.5
chef-client 8.1.6
chef-client 8.1.7
chef-client 8.1.8
chef-client 9.0.0
chef-client 9.0.1
chef-client 9.0.2
chef-client 9.0.3
chef-client 9.0.4
chef-client 9.0.5
chef-client 10.0.0
chef-client 10.0.1
chef-client 10.0.2
chef-client 10.0.3
chef-client 10.0.4
chef-client 10.0.5
chef-client 10.1.0
chef-client 10.1.2
chef-client 11.0.0
chef-client 11.0.1
chef-client 11.0.2
chef-client 11.0.3
chef-client 11.0.4
chef-client 11.0.5
chef-client 11.1.0
chef-client 11.1.1
chef-client 11.1.2
chef-client 11.1.3
chef-client 11.2.0
chef-client 11.3.0
chef-client 11.3.1
chef-client 11.3.2
chef-client 11.3.3
chef-client 11.3.4
chef-client 11.3.5
chef-client 11.3.6
chef-client 11.4.0
chef-client 11.5.0
chef-client 12.0.0
chef-client 12.0.1
chef-client 12.1.0
chef-client 12.2.0
chef-client 12.3.0
chef-client 12.3.1
chef-client 12.3.2
chef-client 12.3.3
chef-client 12.3.4
chef_changereport_handler Applicable Versions
clamav Applicable Versions
cloudfoundry Applicable Versions
cloudfoundry_service Applicable Versions
common_linux Applicable Versions
cyclesafe_chef Applicable Versions
elk_forwarder Applicable Versions
errbit-server Applicable Versions
et_haproxy Applicable Versions
flapjack Applicable Versions
github_connector Applicable Versions
gitlab Applicable Versions
gitlab-shell Applicable Versions
guardian Applicable Versions
ice Applicable Versions
jmxtrans Applicable Versions
librenms Applicable Versions
librenms-ng Applicable Versions
log_rotations Applicable Versions
logstash Applicable Versions
lxd Applicable Versions
magento-ng Applicable Versions
magentostack Applicable Versions
mercury Applicable Versions
mineos Applicable Versions
mysql_logrotate Applicable Versions
mysqler Applicable Versions
ngx Applicable Versions
nodestack Applicable Versions
noosfero Applicable Versions
openresty Applicable Versions
opsworks_ruby Applicable Versions
piwik Applicable Versions
puma Applicable Versions
rabbitmq Applicable Versions
rubycas Applicable Versions
rundeck-alt Applicable Versions
serf Applicable Versions
simple_passenger Applicable Versions
singularity Applicable Versions
sinopia Applicable Versions
ssm_agent Applicable Versions
stegosoc Applicable Versions
stig Applicable Versions
storj Applicable Versions
sturdy_ssm_agent Applicable Versions
verdaccio Applicable Versions
yumrepo_server Applicable Versions
zabbix-ruby-client Applicable Versions
zf2 Applicable Versions

logrotate Cookbook CHANGELOG

This file is used to list changes made in each version of the
logrotate cookbook.

v2.2.0

Compatibility Notes

The compat_resource dependency was removed. This means we now
require Chef 12.5 or higher. It also means we now better support Chef
13.

Enhancements

  • The global configuration now supports scripts.
  • The package install action (upgrade by default) is now configurable via an attribute.
  • The development environment now more closely follows modern cookbook practices.

Bug Fixes

- ChefSpec matcher now correctly calls ChefSpec.define_matcher.

Contributors

  • Austin Heiman
  • Baptiste Courtois
  • Bogdan Katynski
  • Thomas Dziedzic
  • Tim Smith

v2.1.0

Bug Fixes

  • Restore cookbook parameter for logrotate_app resource due to
    popular demand.

  • Add a template_name parameter to replace the 1.x template
    parameter. The name template can't be used inside a resource
    without conflicting with an attribute of the same name.

  • Fix exception when options specified as a string rather than an
    array

v2.0.0

  • Convert the logrotate_app definition to a resource
  • Accept all options included in logrotate 3.9.2

Known incompatibilities

  • The cookbook parameter to logrotate_app is no longer accepted.

v1.9.2

Bug Fixes

  • Fix deprecation warnings from ChefSpec

v1.9.1

Bug Fixes

  • Fixes regression in the sharedscripts logrotate_app parameter (Bug #69)

v1.9.0

Improvements

  • All configuration options from the logrotate 3.8.8 manual page can
    be used by the global configuration and the logrotate_app
    definition.

  • Berkshelf is no longer a development dependency of the
    logrotate cookbook.

  • Rubocop lint failures have been resolved.

v1.8.0

Resolved Bugs

  • su parameter now supported in global config.

Improvements

  • firstaction and lastaction attributes documented in the README
  • rotate attribute documented in the README
  • Use hash-rocket syntax in rspec matcher to maintain 1.9 support.

v1.7.0

Bugs

  • Use raise rather than Application.fatal! to prevent killing a daemonized chef-client

Improvements

  • Chefspec matcher for logrotate_app definition
  • Support the following options: compressoptions, maxage, shred/shredcycles, extension, tabooext
  • Add Solaris support

v1.6.0

Bugs

  • Fix documentation error

Improvements

  • Support for options "compresscmd", "uncompresscmd", "compressext"
  • Allow nodateext as parameter for logrotate_app definition
  • Move to chefspec ~> 3.0

v1.5.0

Bugs

  • Fix missing end tag in template
  • Don't re-initialize constants.
  • Fix rubocop finding

Improvements

  • [COOK-3911] Allow to use maxsize parameter.
  • [COOK-4000] Allow to use dateyesterday option.
  • [COOK-4024] Allow to use su parameter.
  • [COOK-4175] Allows use of the dateformat parameter.
  • Loosen test-kitchen version constraint
  • Add rvm files to gitignore

v1.4.0

Bug

  • COOK-3632 - Raise Exception when adding more than one invalid option
  • COOK-3141 - Do not duplicate template entires for multiple paths
  • COOK-3034 - Update logrotate_app params to accept arrays and strings

Improvement

  • COOK-2646 - Add ability to choose file mode for logrotate template

v1.3.0

Improvement

  • COOK-3341 - Add optional frequency and rotate params when defined globally
  • COOK-3298 - Use Array instead of respond_to?(:each)
  • COOK-3285 - Change logrotate.d config file mode to 0644
  • COOK-3250 - Add minsize

Bug

  • COOK-3274 - Fix README typo that suggested the opposite action

New Feature

v1.2.2

Bug

  • [COOK-2872]: Add firstaction/lastaction ability to logrotate
  • [COOK-2908]: Argument error in logrotate_app definition

v1.2.0

  • [COOK-2401] - Add the ability to manage the global logrotate configuration

v1.1.0

  • [COOK-2218] - Logrotate size parameter

v1.0.2

  • [COOK-1027] - Add support for pre-/post-rotate commands
  • [COOK-1338] - Update log rotate for more flexibility of rotate options
  • [COOK-1598] - "Create" isn't a mandatory option

Collaborator Number Metric
            

2.2.0 passed this metric

Contributing File Metric
            

2.2.0 passed this metric

Foodcritic Metric
            

2.2.0 failed this metric

FC069: Ensure standardized license defined in metadata: logrotate/metadata.rb:1
FC109: Use platform-specific package resources instead of provider property: logrotate/recipes/default.rb:23
Run with Foodcritic Version 14.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

2.2.0 passed this metric

Testing File Metric
            

2.2.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

2.2.0 passed this metric