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

Unified Diff: modules/logstash/manifests/pipeline.pp

Issue 29327588: Issue 2864 - Introduce class logstash (Closed)
Patch Set: Issue 2864 - Address feedback from code-review Created Oct. 20, 2015, 1:04 p.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
« no previous file with comments | « modules/logstash/manifests/init.pp ('k') | modules/logstash/templates/elastic-logstash-gpg-key.erb » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/logstash/manifests/pipeline.pp
diff --git a/modules/logstash/manifests/pipeline.pp b/modules/logstash/manifests/pipeline.pp
new file mode 100644
index 0000000000000000000000000000000000000000..c5e3fb222c9f8c19a2ce1cac0ea71221fe49f66d
--- /dev/null
+++ b/modules/logstash/manifests/pipeline.pp
@@ -0,0 +1,75 @@
+# == Type: logstash::pipeline
+#
+# Manage Logstash (https://logstash.net/) pipeline configuration files.
+#
+# While one can directly provide the configuration $source or $content, one
+# should note that a logstash::pipeline resource is actually the head of the
+# logfile for concatenation (analogous to file_concat or module concat). Use
+# logstash::fragment to assemble such a file from multiple resources.
+#
+# === Parameters:
+#
+# [*content*]
+# The configuration as-is, mutually exclusive with $source.
+#
+# [*ensure*]
+# Either 'present' or 'absent'.
+#
+# [*source*]
+# The configuration source location, mutually exclusive with $content.
+#
+# === Examples:
+#
+# Below please find a list of examples on how to use this type. Examples
+# on how to configure a Logstash pipeline are provided by Elastic at
+# https://www.elastic.co/guide/en/logstash/current/config-examples.html
+#
+# # A pipeline setup using logstash::fragment
+# logstash::pipeline {'alpha':
+# ensure => 'present',
+# }
+#
+# # A pipeline setup from a single template
+# logstash::pipeline {'beta':
+# content => template('custom/pipeline.erb'),
+# }
+#
+# # An obsolete setup to be removed if present
+# logstash::pipeline {'gamma':
+# ensure => 'absent',
+# }
+#
+# For more information on how to use logstash::fragment with a pipeline
+# like 'alpha' above please refer to the accompanying fragment.pp file.
+#
+define logstash::pipeline(
+ $content = undef,
+ $ensure = 'present',
+ $source = undef,
+) {
+
+ $id = "logstash::pipeline#$title"
+ $path = sprintf("/etc/logstash/conf.d/puppet-%s.conf", uriescape($title))
+
+ if $ensure !~ /^(absent|purged)$/ {
+
+ concat {$id:
+ notify => Service['logstash'],
+ path => $path,
+ require => Package['logstash'],
+ }
+
+ concat::fragment {$id:
+ content => $content,
+ order => 0,
+ source => $source,
+ target => $id,
+ }
+ }
+ elsif !defined(File[$path]) {
+
+ file {$path:
+ ensure => 'absent',
+ }
+ }
+}
« no previous file with comments | « modules/logstash/manifests/init.pp ('k') | modules/logstash/templates/elastic-logstash-gpg-key.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld