diff --git a/manifests/filter.pp b/manifests/filter.pp new file mode 100644 index 0000000..fa2a719 --- /dev/null +++ b/manifests/filter.pp @@ -0,0 +1,14 @@ +# Configure a fluentd filter +# +define fluentd::filter ( + $ensure = present, + $priority = 20, + $pattern = '', + $config = {}, +) { + fluentd::config::file { "filter-${title}": + ensure => $ensure, + priority => $priority, + content => template( 'fluentd/filter.erb'), + } +} diff --git a/templates/filter.erb b/templates/filter.erb new file mode 100644 index 0000000..fb27385 --- /dev/null +++ b/templates/filter.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 -%> +