Defined Type: logstash::conf

Defined in:
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:

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


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

define logstash::conf(
    $content  = undef,
    $source   = undef,
    $priority = 10,
    $ensure   = present,
) {
    include ::logstash

    $config_name = inline_template('<%= @title.gsub(/\W/, "-") %>')

    file { "/etc/logstash/conf.d/${priority}-${config_name}.conf":
        ensure       => $ensure,
        content      => $content,
        source       => $source,
        owner        => 'logstash',
        group        => 'logstash',
        mode         => '0440',
        notify       => Service['logstash'],
        validate_cmd => '/usr/local/bin/logstash-config-test %',
    }
}