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 38f00b7162)
changes/28/793928/1
Paul Leimer 1 month ago
parent
commit
8f3a88ba27
2 changed files with 28 additions and 3 deletions
  1. +9
    -1
      manifests/profile/base/logging/rsyslog.pp
  2. +19
    -2
      manifests/profile/base/logging/rsyslog/file_input.pp

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

@ -50,6 +50,11 @@
# (Optional) Hash. Configuration for output plugin omamqp1.
# 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', []),
@ -58,6 +63,7 @@ class tripleo::profile::base::logging::rsyslog (
$elasticsearch_tls_client_cert = undef,
$elasticsearch_tls_client_key = undef,
$amqp1 = undef,
$reopen_on_truncate = undef,
) {
if $step >= 2 {
# NOTE: puppet-rsyslog does not have params manifest, so we don't have any
@ -144,6 +150,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