From 49857ddb1df7eb475123ae34ed2406be3bc9c3aa Mon Sep 17 00:00:00 2001 From: Max Wilhelm Date: Tue, 1 Dec 2015 14:19:18 +0100 Subject: [PATCH] added fluentd::match definition --- manifests/match.pp | 14 ++++++++++++++ templates/match.erb | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 manifests/match.pp create mode 100644 templates/match.erb diff --git a/manifests/match.pp b/manifests/match.pp new file mode 100644 index 0000000..7d119c8 --- /dev/null +++ b/manifests/match.pp @@ -0,0 +1,14 @@ +# Configure a fluentd match +# +define fluentd::match ( + $ensure = present, + $priority = 30, + $pattern = '', + $config = {}, +) { + fluentd::config::file { "match-${title}": + ensure => $ensure, + priority => $priority, + content => template( 'fluentd/match.erb'), + } +} diff --git a/templates/match.erb b/templates/match.erb new file mode 100644 index 0000000..6521242 --- /dev/null +++ b/templates/match.erb @@ -0,0 +1,13 @@ +> +<% @config.each do |key, val| -%> + <%- if val.is_a?( Hash ) -%> + <<%= key -%>> + <%- val.each do |key, val| -%> + <%= key -%> <%= val %> + <%- end -%> + > + <%- else -%> + <%= key -%> <%= val %> + <%- end -%> +<% end -%> +