Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
- , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'simp-logrotate', '6.9.0'
Learn more about managing modules with a PuppetfileDocumentation
pupmod-simp-logrotate
Table of Contents
- Description
- Setup - The basics of getting started with logrotate
- Usage - Configuration options and additional functionality
- Reference
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Description
Configure LogRotate global options.
Use logrotate::rule
for specific configuration options.
Setup
What logrotate affects
Manages the following:
logrotate
package/etc/logrotate.conf
file/etc/logrotate.simp.d
directory and its contents
Setup Requirements
This module requires the following:
Usage
class { 'logrotate': }
Reference
See REFERENCE.md.
Limitations
SIMP Puppet modules are generally intended for use on Red Hat Enterprise
Linux and compatible distributions, such as CentOS. Please see the
metadata.json
file for the most up-to-date list of
supported operating systems, Puppet versions, and module dependencies.
Development
Please read our Contribution Guide.
If you find any issues, they can be submitted to our JIRA.
Reference
Table of Contents
Classes
logrotate
: Configure LogRotate global options Uselogrotate::rule
for specific configuration options.
Defined types
logrotate::rule
: Add a LogRotate Configuration If options have a 'no' variant, then the no variant will be set if you set the primary value to false The ``l
Data types
Logrotate::Periods
: Allowed time intervals for logrotateLogrotate::Size
: Size of a log in bytes, kilobytes, megabytes or gigabytes
Classes
logrotate
Configure LogRotate global options
Use logrotate::rule
for specific configuration options.
Parameters
The following parameters are available in the logrotate
class:
rotate_period
rotate
create
compress
configdir
include_dirs
manage_wtmp
dateext
dateformat
dateyesterday
maxsize
minsize
package_ensure
logger_service
rotate_period
Data type: Logrotate::Periods
How often to rotate the logs
Default value: 'weekly'
rotate
Data type: Integer[0]
The number of times to rotate the logs before removing them from the system
Default value: 4
create
Data type: Boolean
Create new log files if they do not exist
Default value: true
compress
Data type: Boolean
Compress the logs upon rotation
Default value: true
configdir
Data type: Stdlib::Absolutepath
The primary directory for SIMP-managed configuration files.
Default value: '/etc/logrotate.simp.d'
include_dirs
Data type: Array[Stdlib::Absolutepath]
Directories to include in your logrotate configuration
$logrotate::configdir
is always included and is listed first- Be sure to include
/etc/logrotate.d
in this list if you override the default.
Default value: [ '/etc/logrotate.d' ]
manage_wtmp
Data type: Boolean
Set to false
if you do not want /var/log/wtmp
to be managed by
logrotate
Default value: true
dateext
Data type: Boolean
Use dateext
as the suffix for rotated files
Default value: true
dateformat
Data type: String[1]
The format of the date to be appended
- Leaving as is allows for multiple rotations per day
Default value: '-%Y%m%d.%s'
dateyesterday
Data type: Optional[Boolean]
Say 'yesterday' instead of the date
Default value: undef
maxsize
Data type: Optional[Logrotate::Size]
The default maximum size of a logfile
Default value: undef
minsize
Data type: Optional[Logrotate::Size]
The default minimum size of a logfile
- Overrides the
maxsize
setting
Default value: undef
package_ensure
Data type: String[1]
The ensure status of packages to be installed
Default value: simplib::lookup('simp_options::package_ensure', { 'default_value' => 'installed' })
logger_service
Data type: String[1]
The service that controls system logging
- This is used by the
logrotate::rule
define to note the name of the service to be restarted if, and only if, the default lastaction is enabled.
Default value: 'rsyslog'
Defined types
logrotate::rule
Add a LogRotate Configuration
If options have a 'no' variant, then the no variant will be set if you set the primary value to false
The logrotate(5)
man page should be referenced for any undocumented
parameter.
- See also
- logrotate(5)
Parameters
The following parameters are available in the logrotate::rule
defined type:
name
log_files
compress
compresscmd
uncompresscmd
compressext
compressoptions
copy
copytruncate
create
rotate_period
dateext
dateformat
dateyesterday
delaycompress
extension
ifempty
ext_include
mail
maillast
maxage
maxsize
minsize
missingok
olddir
postrotate
prerotate
firstaction
lastaction
lastaction_restart_logger
logger_service
rotate
size
sharedscripts
shred
shredcycles
start
su
su_user
su_group
tabooext
name
Data type: String
Directly translates to the name of the file
log_files
Data type: Array[String[1]]
The log file strings for all logs to be affected by this stanza
compress
Data type: Optional[Boolean]
If undefined it defaults to the setting in logrotate.
Default value: undef
compresscmd
Data type: Optional[String[1]]
Default value: undef
uncompresscmd
Data type: Optional[String[1]]
Default value: undef
compressext
Data type: Optional[String[1]]
Default value: undef
compressoptions
Data type: Optional[String[1]]
Default value: undef
copy
Data type: Boolean
Default value: false
copytruncate
Data type: Boolean
Default value: false
create
Data type: Pattern['\d{4} .+ .+']
Default value: '0640 root root'
rotate_period
Data type: Optional[Logrotate::Periods]
Default value: undef
dateext
Data type: Optional[Boolean]
If set to true log files will be rotated using a date extension. If false nodateext is set and rotated logs use a number extension. If undefined it defaults to the setting in logrotate
Default value: undef
dateformat
Data type: String[1]
Default value: '-%Y%m%d.%s'
dateyesterday
Data type: Optional[Boolean]
Default value: undef
delaycompress
Data type: Optional[Boolean]
Default value: undef
extension
Data type: Optional[String[1]]
Default value: undef
ifempty
Data type: Boolean
Default value: false
ext_include
Data type: Optional[Array[String[1]]]
Corresponds to the include
logrotate configuration since it is a
reserved word in Puppet
Default value: undef
mail
Data type: Optional[Simplib::EmailAddress]
Default value: undef
maillast
Data type: Boolean
If false, mailfirst will be set. Ignored if $mail is false
Default value: true
maxage
Data type: Optional[Integer[0]]
Default value: undef
maxsize
Data type: Optional[Logrotate::Size]
Default value: undef
minsize
Data type: Optional[Logrotate::Size]
Default value: undef
missingok
Data type: Boolean
Default value: false
olddir
Data type: Optional[Stdlib::Absolutepath]
Default value: undef
postrotate
Data type: Optional[String[1]]
Default value: undef
prerotate
Data type: Optional[String[1]]
Default value: undef
firstaction
Data type: Optional[String[1]]
Default value: undef
lastaction
Data type: Optional[String[1]]
Default value: undef
lastaction_restart_logger
Data type: Boolean
Restart $logger_service
as a logrotate lastaction
- Has no effect if
$lastaction
is set
Default value: false
logger_service
Data type: Optional[String[1]]
The name of the service which will be restarted as a logrotate lastaction
- NOTE: This will default to
rsyslog
unless otherwise specified either in the call to the define or aslogrotate::logger_service
Default value: simplib::lookup('logrotate::logger_service', {'default_value' => 'rsyslog'})
rotate
Data type: Optional[Integer[0]]
The number of old log files to keep. If undefined it defaults to the setting in logrotate
Default value: undef
size
Data type: Optional[Logrotate::Size]
Default value: undef
sharedscripts
Data type: Boolean
Default value: true
shred
Data type: Optional[Boolean]
Default value: undef
shredcycles
Data type: Optional[Integer[0]]
Default value: undef
start
Data type: Integer[0]
Default value: 1
su
Data type: Boolean
Rotate logs as a different user and group. $su_user and $su_group are required if this is set to true. Ignored on EL6.
Default value: false
su_user
Data type: Optional[String[1]]
Default value: undef
su_group
Data type: Optional[String[1]]
Default value: undef
tabooext
Data type: Optional[Array[String[1]]]
Default value: undef
Data types
Logrotate::Periods
Allowed time intervals for logrotate
Alias of Enum['hourly', 'daily', 'weekly', 'monthly', 'yearly']
Logrotate::Size
Size of a log in bytes, kilobytes, megabytes or gigabytes
Alias of Variant[Integer[1], Pattern[/^[0-9]+[kMG]?$/]]
- Mon Oct 23 2023 Steven Pritchard steve@sicura.us - 6.9.0
- [puppetsync] Add EL9 support
- Wed Oct 11 2023 Steven Pritchard steve@sicura.us - 6.8.0
- [puppetsync] Updates for Puppet 8
- These updates may include the following:
- Update Gemfile
- Add support for Puppet 8
- Drop support for Puppet 6
- Update module dependencies
- These updates may include the following:
- Mon Jun 12 2023 Chris Tessmer chris.tessmer@onyxpoint.com - 6.7.0
- Add RockyLinux 8 support
- Sat Jan 22 2022 Trevor Vaughan trevor@sicura.us - 6.6.1
- Add support for Amazon Linux 2
- Tue Jun 15 2021 Chris Tessmer chris.tessmer@onyxpoint.com - 6.6.0
- Removed support for Puppet 5
- Ensured support for Puppet 7 in requirements and stdlib
- Mon Jan 11 2021 Chris Tessmer chris.tessmer@onyxpoint.com - 6.5.1
- Removed EL6 support
- Removed OBE doc directory
- Fri Jan 03 2020 Jeanne Greulich jeanne,greulich@onyxpoint.com - 6.5.0-0
- Allow all log size configuration parameters to be specified in bytes, kilobytes, megabytes, or gigabytes.
- Fixed a bug in which the size parameter in the global logrotate configuration file was specified more than once.
- Added ability to specify maxsize configuration for specific log rotate rules.
- Thu Dec 19 2019 Trevor Vaughan tvaughan@onyxpoint.com - 6.5.0-0
- Add EL8 support
- Thu Jun 06 2019 Steven Pritchard steven.pritchard@onyxpoint.com - 6.4.0-0
- Add v2 compliance_markup data
- Mon Mar 11 2019 Liz Nemsick lnemsick.simp@gmail.com - 6.3.1-0
- Updated a URL in the README.md
- Thu Nov 01 2018 Jeanne Greulich jeanne,greulich@onyxpoint.com - 6.3.0-0
- static asset updates for puppet 5
- Mon Oct 01 2018 Nick Miller nick.miller@onyxpoint.com - 6.3.0-0
- Added OEL and Puppet 5 support
- Add some previously impossible to configure options
- the hourly rotate period
- dateyesterday
- shred and shredcycles
- su and su_user and su_group (inapplicable on EL6)
- Added Logrotate::Periods type alias which allows hourly rotation
- Mon Jul 02 2018 Liz Nemsick lnemsick.simp@gmail.com - 6.2.0-0
- Move SIMP-specific logrotate rules to a SIMP-managed configuration directory, /etc/logrotate.simp.d, and ensure logrotate processes that directory first. This ensures SIMP rules take priority, when duplicate rules are specified.
- Thu Nov 30 2017 Steven Pritchard steven.pritchard@onyxpoint.com - 6.1.2-0
- Update README.md from puppet strings
- Fri Sep 01 2017 Jeanne Greulich jeanne.greulich@onyxpoint.com - 6.1.1-0
- Updated the defaults settings for compress, rotate and dateext in rule.pp to pull values from init.pp. (They were hard coded to them before)
- changed templates to add nodateext if dateext is set to false.
- Thu Apr 13 2017 Nick Markowski nmarkowski@keywcorp.com - 6.1.0-0
- Added lastaction logic to logrotate::rule.
- Update puppet requirement and remove OBE pe requirement in metadata.json
- Fri Dec 16 2016 Trevor Vaughan tvaughan@onyxpoint.com - 6.0.0-0
- Updated for Puppet 4
- Renamed the
logrotate::add
defined type tologrotate::rule
- Fri Nov 18 2016 Chris Tessmer chris.tessmer@onyxpoint.com - 5.0.0-0
- Updated to compliance_markup version 2
- Tue Feb 23 2016 Ralph Wright ralph.wright@onyxpoint.com - 4.1.0-4
- Added compliance function support
- Tue Jan 26 2016 Chris Tessmer chris.tessmer@onypoint.com - 4.1.0-3
- Normalized common static module assets
- Fri Jan 16 2015 Trevor Vaughan tvaughan@onyxpoint.com - 4.1.0-2
- Changed puppet-server requirement to puppet
- Mon Aug 25 2014 Kendall Moore kmoore@keywcorp.com - 4.1.0-1
- The upgrade to ruby 2.0 caused empty includes with arrays of length 0.
- Sun Mar 02 2014 Kendall Moore kmoore@keywcorp.com - 4.1.0-0
- Refactored to pass all lint tests and be compatible with hiera and puppet 3.
- Added rspec tests for test coverage.
- Thu Feb 13 2014 Kendall Moore kmoore@keywcorp.com - 4.0.0-10
- Converted all string booleans into native booleans.
- Mon Oct 07 2013 Kendall Moore kmoore@keywcorp.com - 4.0.0-9
- Updated all erb templates to properly scope variables.
- Tue Jul 09 2013 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-8
- Fixed a typo whereby 'include' statements were not processed due to extraneous double quotes.
- Moved the tabooext option outside of the main option set since, according to the docs, it simply overwrites or appends to the previous value anyway.
- Thu Jan 24 2013 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-7
- Created a Cucumber test that ensures logrotate is working by creating a test log.
- Tue Oct 23 2012 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-6
- Changed the default configuration so that empty files no longer get rotated.
- Fri Aug 17 2012 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-5
- Added the dateext -%Y%m%d.%s so that logs can be rotated multiple times per day.
- Added a default rotate size of 500M to attempt to ensure that the /var/log filesystem doesn't rapidly fill.
- Moved the 'conf' portion into the logrotate class by converting it to a parameterized class.
- Thu Jun 07 2012 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-4
- Ensure that Arrays in templates are flattened.
- Call facts as instance variables.
- Moved mit-tests to /usr/share/simp...
- Updated pp files to better meet Puppet's recommended style guide.
- Fri Mar 02 2012 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-3
- Improved test stubs.
- Mon Dec 26 2011 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-2
- Updated the spec file to not require a separate file list.
- Mon Dec 05 2011 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-1
- Modified the logrotate 'conf' template to properly detect dateext and flipped the dateext variable so that existing systems continue to work the same way.
- Mon Nov 07 2011 Trevor Vaughan tvaughan@onyxpoint.com - 4.0.0-0
- Set $sharedscripts to 'true' by default.
- Sat Jun 25 2011 Trevor Vaughan tvaughan@onyxpoint.com - 2.0.0-2
- No longer manage /etc/logrotate.conf by default.
- Provide a define, logrotate::conf, for customization of /etc/logrotate.conf
- Ensure that the logrotate package is installed and up to date.
- Mon Apr 18 2011 Trevor Vaughan tvaughan@onyxpoint.com - 2.0.0-1
- Changed puppet://$puppet_server/ to puppet:///
- Tue Jan 11 2011 Trevor Vaughan tvaughan@onyxpoint.com - 2.0.0-0
- Refactored for SIMP-2.0.0-alpha release
- Tue Oct 26 2010 Trevor Vaughan tvaughan@onyxpoint.com - 1.0-1
- Converting all spec files to check for directories prior to copy.
- Fri May 21 2010 Trevor Vaughan tvaughan@onyxpoint.com - 1.0-0
- Doc update and code refactor
- Thu Jan 28 2010 Trevor Vaughan tvaughan@onyxpoint.com - 0.1-1
- Changed the default 'rotate' value to 4 instead of 7.
- Wed Nov 04 2009 Trevor Vaughan tvaughan@onyxpoint.com - 0.1-0
- Initial module release.
Dependencies
- puppetlabs/stdlib (>= 8.0.0 < 10.0.0)
- simp/simplib (>= 4.9.0 < 5.0.0)
pupmod-simp-logrotate - A Puppet Module for managing Logrotate -- Per Section 105 of the Copyright Act of 1976, these works are not entitled to domestic copyright protection under US Federal law. The US Government retains the right to pursue copyright protections outside of the United States. The United States Government has unlimited rights in this software and all derivatives thereof, pursuant to the contracts under which it was developed and the License under which it falls. --- 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.