Browse Source

Add option to set rsyslog reopenOnTruncate parameter for all services

If defined, set reopenOnTruncate rsyslog imfile option for all services. Paremeter definition set by the services takes precedence

Change-Id: I5870c0689434eaca8d114cd83e1164e1454565d7
(cherry picked from commit 8f3a88ba27)
changes/00/794600/1
Paul Leimer 1 month ago
parent
commit
94936054ac
2 changed files with 29 additions and 3 deletions
  1. +10
    -1
      manifests/profile/base/logging/rsyslog.pp
  2. +19
    -2
      manifests/profile/base/logging/rsyslog/file_input.pp

+ 10
- 1
manifests/profile/base/logging/rsyslog.pp View File

@ -45,6 +45,12 @@
# (Optional) String. Contains content of the private key corresponding to
# the cert elasticsearch_tls_client_cert.
# Defaults to undef
#
# [*reopen_on_truncate*]
# (Optional) String. Set all rsyslog imfile reopenOnTruncate parameters
# unless it is already specified in hiera
# Defaults to undef
#
class tripleo::profile::base::logging::rsyslog (
$step = Integer(hiera('step')),
$service_names = hiera('service_names', []),
@ -52,6 +58,7 @@ class tripleo::profile::base::logging::rsyslog (
$elasticsearch_tls_ca_cert = undef,
$elasticsearch_tls_client_cert = undef,
$elasticsearch_tls_client_key = undef,
$reopen_on_truncate = undef,
) {
if $step >= 2 {
# NOTE: puppet-rsyslog does not have params manifest, so we don't have any
@ -115,6 +122,8 @@ class tripleo::profile::base::logging::rsyslog (
modules => $modules,
actions => $actions
}
tripleo::profile::base::logging::rsyslog::file_input{$service_names: }
tripleo::profile::base::logging::rsyslog::file_input{$service_names:
reopen_on_truncate => $reopen_on_truncate
}
}
}

+ 19
- 2
manifests/profile/base/logging/rsyslog/file_input.pp View File

@ -12,9 +12,15 @@
# tripleo_logging_sources_<service name>.
# Defaults to '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]+ [0-9]+)? (DEBUG|INFO|WARNING|ERROR) '
#
# [*reopen_on_truncate*]
# (Optional) String. Set all rsyslog imfile reopenOnTruncate parameters
# unless it is already specified in hiera
# Defaults to undef
#
define tripleo::profile::base::logging::rsyslog::file_input (
$sources = hiera("tripleo_logging_sources_${title}", undef),
$default_startmsg = '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]+ [0-9]+)? (DEBUG|INFO|WARNING|ERROR) '
$default_startmsg = '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]+ [0-9]+)? (DEBUG|INFO|WARNING|ERROR) ',
Optional[Enum['on','off']] $reopen_on_truncate = undef
) {
if $sources {
$sources_array = Array($sources, true)
@ -24,7 +30,18 @@ define tripleo::profile::base::logging::rsyslog::file_input (
} else {
$record = $config
}
$memo + [$record]
if ! $config['reopenOnTruncate'] {
if $reopen_on_truncate {
$record2 = $record + {'reopenOnTruncate' => $reopen_on_truncate}
} else {
$record2 = $record
}
} else {
$record2 = $record
}
$memo + [$record2]
}
$rsyslog_sources.each |$config| {


Loading…
Cancel
Save