voxpupuli/puppet-logrotate

Name: puppet-logrotate

Owner: Vox Pupuli

Description: Puppet logrotate module

Created: 2015-03-03 14:45:56.0

Updated: 2017-10-13 23:20:15.0

Pushed: 2018-01-16 13:37:43.0

Homepage:

Size: 276

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Logrotate module for Puppet

License Build Status Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

Description

A more Puppety way of managing logrotate configs. Where possible, as many of the configuration options have remained the same with a couple of notable exceptions:

logrotate::conf

You may, optionally, define logrotate defaults using this defined type. Parameters are the same as those for logrotate::rule. Using this type will automatically include a private class that will install and configure logrotate for you.

logrotate::rule

The only thing you'll need to deal with, this type configures a logrotate rule. Using this type will automatically include a private class that will install and configure logrotate for you.

var         - The String name of the rule.
            - The path String to the logfile(s) to be rotated.
re          - The desired state of the logrotate rule as a String.  Valid
              values are 'absent' and 'present' (default: 'present').
ress        - A Boolean value specifying whether the rotated logs should
              be compressed (optional).
resscmd     - The command String that should be executed to compress the
              rotated logs (optional).
ressext     - The extention String to be appended to the rotated log files
              after they have been compressed (optional).
ressoptions - A String of command line options to be passed to the
              compression program specified in `compresscmd` (optional).
            - A Boolean specifying whether logrotate should just take a
              copy of the log file and not touch the original (optional).
truncate    - A Boolean specifying whether logrotate should truncate the
              original log file after taking a copy (optional).
te          - A Boolean specifying whether logrotate should create a new
              log file immediately after rotation (optional).
te_mode     - An octal mode String logrotate should apply to the newly
              created log file if create => true (optional).
te_owner    - A username String that logrotate should set the owner of the
              newly created log file to if create => true (optional).
te_group    - A String group name that logrotate should apply to the newly
              created log file if create => true (optional).
ext         - A Boolean specifying whether rotated log files should be
              archived by adding a date extension rather just a number
              (optional).
format      - The format String to be used for `dateext` (optional).
              Valid specifiers are '%Y', '%m', '%d' and '%s'.
yesterday   - A Boolean specifying whether to use yesterday's date instead
              of today's date to create the `dateext` extension (optional).
ycompress   - A Boolean specifying whether compression of the rotated
              log file should be delayed until the next logrotate run
              (optional).
nsion       - Log files with this extension String are allowed to keep it
              after rotation (optional).
pty         - A Boolean specifying whether the log file should be rotated
              even if it is empty (optional).
            - The email address String that logs that are about to be
              rotated out of existence are emailed to (optional).
first       - A Boolean that when used with `mail` has logrotate email the
              just rotated file rather than the about to expire file
              (optional).
last        - A Boolean that when used with `mail` has logrotate email the
              about to expire file rather than the just rotated file
              (optional).
ge          - The Integer maximum number of days that a rotated log file
              can stay on the system (optional).
ize         - The String minimum size a log file must be to be rotated,
              but not before the scheduled rotation time (optional).
              The default units are bytes, append k, M or G for kilobytes,
              megabytes and gigabytes respectively.
ize         - The String maximum size a log file may be to be rotated;
              When maxsize is used, both the size and timestamp of a log
              file are considered for rotation.
              The default units are bytes, append k, M or G for kilobytes,
              megabytes and gigabytes respectively.
ingok       - A Boolean specifying whether logrotate should ignore missing
              log files or issue an error (optional).
ir          - A String path to a directory that rotated logs should be
              moved to (optional).
rotate      - A command String that should be executed by /bin/sh after
              the log file is rotated (optional).
otate       - A command String that should be executed by /bin/sh before
              the log file is rotated and only if it will be rotated
              (optional).
taction     - A command String that should be executed by /bin/sh once
              before all log files that match the wildcard pattern are
              rotated (optional).
action      - A command String that should be execute by /bin/sh once
              after all the log files that match the wildcard pattern are
              rotated (optional).
te          - The Integer number of rotated log files to keep on disk
              (optional).
te_every    - How often the log files should be rotated as a String.
              Valid values are 'hour', 'day', 'week', 'month' and 'year'
              (optional).  Please note, older versions of logrotate do not
              support yearly log rotation.
            - The String size a log file has to reach before it will be
              rotated (optional).  The default units are bytes, append k,
              M or G for kilobytes, megabytes or gigabytes respectively.
edscripts   - A Boolean specifying whether logrotate should run the
              postrotate and prerotate scripts for each matching file or
              just once (optional).
d           - A Boolean specifying whether logs should be deleted with
              shred instead of unlink (optional).
dcycles     - The Integer number of times shred should overwrite log files
              before unlinking them (optional).
t           - The Integer number to be used as the base for the extensions
              appended to the rotated log files (optional).
wner        - A username String that logrotate should use to rotate a
              log file set instead of using the default if
              su => true (optional).
roup        - A String group name that logrotate should use to rotate a
              log file set instead of using the default if
              su => true (optional).
mpresscmd   - The String command to be used to uncompress log files
              (optional).

Further details about these options can be found by reading man 8 logrotate.

logrotate

You may, optionally, declare the main ::logrotate class to adjust some of the defaults that are used when installing the logrotate package and creating the main /etc/logrotate.conf configuration file.

This example will ensure that the logrotate package is latest and that the dateext and compress options are added to the defaults for a node.

s { '::logrotate':
sure => 'latest',
nfig => {
dateext  => true,
compress => true,


Examples
otate::conf { '/etc/logrotate.conf':
tate       => 10,
tate_every => 'week',
empty      => true,
teext      => true,


otate::rule { 'messages':
th         => '/var/log/messages',
tate       => 5,
tate_every => 'week',
strotate   => '/usr/bin/killall -HUP syslogd',


otate::rule { 'apache':
th          => '/var/log/httpd/*.log',
tate        => 5,
il          => 'test@example.com',
ze          => '100k',
aredscripts => true,
strotate    => '/etc/init.d/httpd restart',

Authors and Module History

Puppet-logrotate has been maintained by VoxPupuli since version 2.0.0. It was migrated from https://forge.puppet.com/yo61/logrotate. yo61's version was a fork of https://github.com/rodjek/puppet-logrotate. It is licensed under the MIT license.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.