Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/manifests/log/tracker.pp

Issue 29339248: Issue 3305 - Introduce adblockplus::log::tracker and ::forwarder (Closed)
Patch Set: Created April 1, 2016, 9:12 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/adblockplus/manifests/log/tracker.pp
diff --git a/modules/adblockplus/manifests/log/tracker.pp b/modules/adblockplus/manifests/log/tracker.pp
new file mode 100644
index 0000000000000000000000000000000000000000..d966d2069f725c032b9c6d1c8d47fb7d4aea0375
--- /dev/null
+++ b/modules/adblockplus/manifests/log/tracker.pp
@@ -0,0 +1,59 @@
+# == Type: adblockplus::log::tracker
+#
+# Establish monitoring for a single log-file source on the current node,
+# connected to the adblockplus::log::forwarder output, if any.
+#
+# === Parameters:
+#
+# [*ensure*]
+# Whether the tracker is supposed to be 'present' or 'absent', defaults
+# to $adblockplus::log::ensure.
+#
+# [*format*]
+# Either the name of a pre-configured format specific to the (Fluentd)
+# system setup or a regular expression with named groups for extracting
+# the log event's properties.
+#
+# [*name*]
+# Translates literally into a tag attached to the tracked log event.
+#
+# [*path*]
+# The full path to the log file being tracked, required to be unique.
+#
+# === Examples:
+#
+# adblockplus::log::tracker {'example1':
+# format => 'nginx',
+# name => 'foobar.access',
+# path => '/var/log/nginx/access.log',
+# }
+#
+# adblockplus::log::tracker {'example2':
+# path => '/var/log/nginx/error.log',
+# name => 'foorbar.error',
Fred 2016/04/06 18:03:03 typo (foobar)
mathias 2016/04/06 19:16:27 Acknowledged.
+# format => '/^(?<message>.+)$/',
+# }
+#
+# adblockplus::log::tracker {'/var/log/other.log':
+# ensure => 'absent',
+# }
+#
+define adblockplus::log::tracker (
+ $ensure = undef,
+ $format = '/^(?<message>.*)$/',
+ $path = $title,
+) {
+
+ include adblockplus::log::forwarder
+ include stdlib
+
+ # Used as $title for all resource definitions contained herein
+ $namevar = "adblockplus::log::tracker#$title"
+
+ # See modules/fluent/manifests/config.pp
+ fluent::config {$namevar:
+ content => template('adblockplus/log/fluentd/tracker.conf.erb'),
+ ensure => pick($ensure, $adblockplus::log::ensure),
+ name => sprintf('20-adblockplus-log-tracker-%s', md5($path)),
+ }
+}

Powered by Google App Engine
This is Rietveld