Defined Type: rsyslog::conf

Defined in:
modules/rsyslog/manifests/conf.pp

Overview

Define: rsyslog::conf

Represents an rsyslogd config file. See rsyslog.conf(5).

Parameters

content

The content of the file provided as a string. Either this or 'source' must be specified.

source

The content of the file provided as a puppet:/// file reference. Either this or 'content' must be specified.

priority

A numeric value in range 0 - 99. Files with a lower priority value are evaluated first.

If you're not sure, leave this unspecified. The default value of 60 should suit most cases.

Examples

rsyslog::conf { 'hadoop':
  content  => template('hadoop/hadoop.conf.erb'),
  priority => 90,
}

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: present)
  • content (Optional[String]) (defaults to: undef)
  • source (Optional[String]) (defaults to: undef)
  • priority (Integer[0, 99]) (defaults to: 60)
  • mode (Stdlib::Filemode) (defaults to: '0444')


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'modules/rsyslog/manifests/conf.pp', line 29

define rsyslog::conf (
    Wmflib::Ensure $ensure    = present,
    Optional[String] $content = undef,
    Optional[String] $source  = undef,
    Integer[0, 99] $priority  = 60,
    Stdlib::Filemode $mode    = '0444',
) {
    include ::rsyslog

    $basename = regsubst($title, '[\W_]', '-', 'G')
    $filename = sprintf('/etc/rsyslog.d/%02d-%s.conf', $priority, $basename)

    # append a trailing newline if omitted
    $content_formatted = $content ? {
        undef   => undef,
        default => regsubst($content, "\n?$", "\n")
    }

    file { $filename:
        ensure  => $ensure,
        content => $content_formatted,
        source  => $source,
        owner   => 'root',
        group   => 'root',
        mode    => $mode,
        notify  => Service['rsyslog'],
    }
}