Defined Type: logrotate::rule
- Defined in:
- modules/logrotate/manifests/rule.pp
Summary
Provides a common template that can be used by different applications to configure log rotation. See logrotate man page for detailed documentation. Most parameters of this class map directly to the corresponding logrotate options.Overview
SPDX-License-Identifier: Apache-2.0
28 29 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 58 59 |
# File 'modules/logrotate/manifests/rule.pp', line 28
define logrotate::rule (
String $file_glob,
Wmflib::Ensure $ensure = present,
Optional[Logrotate::Frequency] $frequency = undef,
Boolean $not_if_empty = false,
Boolean $date_yesterday = false,
Boolean $copy_truncate = false,
Optional[Integer[1]] $max_age = undef,
Optional[Integer[1]] $rotate = undef,
Boolean $date_ext = false,
Boolean $compress = false,
Boolean $missing_ok = false,
Optional[Stdlib::Datasize] $size = undef,
Boolean $no_create = false,
Array[String[1]] $post_rotate = [],
Optional[String[1]] $su = undef,
Optional[String[1]] $create = undef,
Optional[Stdlib::Unixpath] $old_dir = undef,
) {
include logrotate
$actual_size = $size.then |$s| {
($frequency =~ Undef).bool2str("size ${s}", "maxsize ${s}")
}
if $frequency == 'hourly' and !$logrotate::hourly {
fail('If using a frequency of hourly then you must also configure `logrotate::hourly: true`')
}
logrotate::conf { $title:
ensure => $ensure,
content => template('logrotate/logrotate.erb'),
}
}
|