aboutsummaryrefslogtreecommitdiffstats
path: root/manifests/profile/base/logging
diff options
context:
space:
mode:
authorLars Kellogg-Stedman <lars@redhat.com>2017-09-11 10:00:18 -0600
committerMartin Mágr <mmagr@redhat.com>2017-09-26 13:37:13 +0200
commit265a13a8e5166ca4cd4cecbf64cb8229e3dcd106 (patch)
tree5598ba5dce7f5559f183218cbe206475f37b99b2 /manifests/profile/base/logging
parentbc3dfc5ac3488ad5411ba4b3856dcf0ff1542692 (diff)
Allow log path transformation in fluentd glue
Logs in a containerized deployment are not in the same location as on a baremetal deployment. This commit adds the $fluentd_path_transform paramter to the fluentd glue module. This is a regular expression that is used to transform log paths. To use this feature, include in your hiera configuration something like: tripleo::profile::base::logging::fluentd::fluentd_path_transform: - /var/log/ - /var/log/containers/ Change-Id: I585b6877074353b5de62e5efaabfbe62432c473d Partial-bug: #1716427 (cherry picked from commit 1ff0903a3950bc4adbc8c84b5153df6ca0fb6a3d)
Diffstat (limited to 'manifests/profile/base/logging')
-rw-r--r--manifests/profile/base/logging/fluentd.pp29
1 files changed, 27 insertions, 2 deletions
diff --git a/manifests/profile/base/logging/fluentd.pp b/manifests/profile/base/logging/fluentd.pp
index b23610a..2e41942 100644
--- a/manifests/profile/base/logging/fluentd.pp
+++ b/manifests/profile/base/logging/fluentd.pp
@@ -58,6 +58,11 @@
# [*fluentd_syslog_port*]
# (Optional, default 42185) Port on which fluentd should listen if
# $fluentd_listen_syslog is true.
+#
+# [*fluentd_path_transform*]
+# (Optional) List. Specifies [find, replace] arguments that will be
+# used to transform the 'path' value for logging sources using puppet's
+# regsubst function.
class tripleo::profile::base::logging::fluentd (
$step = Integer(hiera('step')),
$fluentd_sources = undef,
@@ -69,7 +74,8 @@ class tripleo::profile::base::logging::fluentd (
$fluentd_ssl_certificate = undef,
$fluentd_shared_key = undef,
$fluentd_listen_syslog = true,
- $fluentd_syslog_port = 42185
+ $fluentd_syslog_port = 42185,
+ $fluentd_path_transform = undef
) {
if $step >= 4 {
@@ -98,9 +104,28 @@ class tripleo::profile::base::logging::fluentd (
}
if $fluentd_sources {
+
+ if $fluentd_path_transform {
+ $_fluentd_sources = map($fluentd_sources) |$source| {
+ if $source['path'] {
+ $newpath = {
+ 'path' => regsubst($source['path'],
+ $fluentd_path_transform[0],
+ $fluentd_path_transform[1])
+ }
+
+ $source + $newpath
+ } else {
+ $source
+ }
+ }
+ } else {
+ $_fluentd_sources = $fluentd_sources
+ }
+
::fluentd::config { '100-openstack-sources.conf':
config => {
- 'source' => $fluentd_sources,
+ 'source' => $_fluentd_sources,
}
}
}