Defined Type: rsyslog::template::list

Defined in:
manifests/template/list.pp

Overview

Add a template list to the rsyslog configuration file.

RSyslog list templates can contain properties and constants. In order to capture this functionality, we have opted for making a hash of these. The Hash will be ordered as given to the content variable.

Examples:

Content Settings

$content_hash = {
  'constant' => 'values="Syslog MSG is: \'"',
  'property' => 'name="msg"'
}

rsyslog::template::list { 'example_list':
  $content => $content_hash
}

### Produces:

template(name="example_list" type="list") {
  constant(value="Syslog MSG is: '")
  property(name="msg")
}

Parameters:

  • name

    The literal name (not path) of the file that will be written

  • content (Hash[String,String,1])

    The rsyslog list content that you wish to add to the system, as a Hash



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'manifests/template/list.pp', line 30

define rsyslog::template::list (
  Hash[String,String,1] $content
) {
  $_safe_name = regsubst($name,'/','__')

  $_content = join(map($content) |$key, $value| { "${key}(${value})" }, "\n  ")

  rsyslog::rule { "05_simp_templates/${_safe_name}.conf":
    # lint:ignore:double_quoted_strings lint:ignore:only_variable_string
    content => @("EOM")
      template(name="${name}" type="list") {
        $_content
      }
      |EOM
    # lint:endignore
  }
}