OLD | NEW |
(Empty) | |
| 1 # == Type: logstash::fragment |
| 2 # |
| 3 # Manage Logstash (https://logstash.net/) configuration file fragments. |
| 4 # |
| 5 # === Parameters: |
| 6 # |
| 7 # [*content*] |
| 8 # The configuration as-is, mutually exclusive with $source. |
| 9 # |
| 10 # [*ensure*] |
| 11 # Either 'present' or 'absent'. |
| 12 # |
| 13 # [*order*] |
| 14 # Any index for lexical odering of fragments within the generated file. |
| 15 # |
| 16 # [*source*] |
| 17 # The configuration source location, mutually exclusive with $content. |
| 18 # |
| 19 # [*target*] |
| 20 # The name or resource of the target pipeline configuration. |
| 21 # |
| 22 # === Examples: |
| 23 # |
| 24 # logstash::fragment {'input': |
| 25 # content => template('custom/pipeline-inputs.erb'), |
| 26 # order => 20, |
| 27 # target => Logstash::Pipeline['custom'], |
| 28 # } |
| 29 # |
| 30 # logstash::fragment {'filter': |
| 31 # content => template('custom/pipeline-filters.erb'), |
| 32 # order => 40, |
| 33 # target => Logstash::Pipeline['custom'], |
| 34 # } |
| 35 # |
| 36 # logstash::fragment {'output': |
| 37 # content => template('custom/pipeline-outputs.erb'), |
| 38 # order => 60, |
| 39 # target => Logstash::Pipeline['custom'], |
| 40 # } |
| 41 # |
| 42 define logstash::fragment( |
| 43 $content = undef, |
| 44 $ensure = 'present', |
| 45 $order = 10, |
| 46 $source = undef, |
| 47 $target = 'default', |
| 48 ) { |
| 49 |
| 50 if is_string($target) { |
| 51 $pipeline = Logstash::Pipeline[$target] |
| 52 } |
| 53 else { |
| 54 $pipeline = $target |
| 55 } |
| 56 |
| 57 $pipeline_title = getparam($pipeline, 'title') |
| 58 $pipeline_id = "logstash::pipeline#$pipeline_title" |
| 59 |
| 60 concat::fragment {"logstash::fragment#$title": |
| 61 content => $content, |
| 62 ensure => $ensure, |
| 63 order => $order, |
| 64 source => $source, |
| 65 target => $pipeline_id, |
| 66 } |
| 67 } |
OLD | NEW |