Defined Type: logstash::conf

Defined in:
puppet/modules/logstash/manifests/conf.pp

Overview

Define: logstash::conf

This resource type represents a collection of Logstash configuration directives.

Parameters:

  • $content: String containing Logstash configuration directives. Either this

    or $source must be specified. Undefined by default.
  • $source: Path to file containing Logstash configuration directives. Either

    this or $content must be specified. Undefined by default.
  • $priority: Configuration loading priority. Default 10.

  • $ensure: Whether the config should exist.

Sample usage:

logstash::conf { 'debug':
  content => 'output { stdout { codec => rubydebug } }'
}

Parameters:

  • ensure (Any) (defaults to: present)
  • content (Any) (defaults to: undef)
  • source (Any) (defaults to: undef)
  • priority (Any) (defaults to: 10)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'puppet/modules/logstash/manifests/conf.pp', line 23

define logstash::conf(
    $ensure   = present,
    $content  = undef,
    $source   = undef,
    $priority = 10,
) {
    if $priority !~ Integer[0, 99] {
        fail('"priority" must be between 0 - 99')
    }
    $safe_name   = regsubst($title, '[\W_]', '-', 'G')
    $conf_file = sprintf('%02d-%s', $priority, $safe_name)

    file { "/etc/logstash/conf.d/${conf_file}.conf":
        ensure  => $ensure,
        content => $content,
        source  => $source,
        notify  => Service['logstash'],
    }
}