Puppet Class: logrotate
- Defined in:
- manifests/init.pp
Summary
Install and configure log rotation on LinuxOverview
Management of ‘/etc/logrotate.conf` is performed as edits to avoid clobbering vendor defaults.
The module takes the position that the files laid down by the vendor are correct and only modifies them the minimal amount needed to make the system work - users/admins are trusted not alter files away from the defaults.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'manifests/init.pp', line 30
class logrotate(
String $package = "logrotate",
Hash[String,Any] $settings = {},
Hash[String,Hash[String,Any]] $entries = {},
) {
package { $package:
ensure => present,
}
$settings.each |$key, $opts| {
$value = pick_default($opts, "")
fm_replace { "/etc/logrotate.conf:${key}":
ensure => present,
path => "/etc/logrotate.conf",
data => "${key} ${value}",
match => logrotate::find_match($key),
insert_if_missing => true,
}
}
$entries.each |$key,$opts| {
logrotate::entry { $key:
* => $opts,
}
}
}
|