Defined Type: rsyslog::conf

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

Overview

SPDX-License-Identifier: Apache-2.0

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.

instance

The rsyslog instance to install this configuration for. Defaults to the system's rsyslog instance.

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')
  • instance (Optional[String]) (defaults to: undef)


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'modules/rsyslog/manifests/conf.pp', line 34

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

    if $instance == undef {
        $base = '/etc/rsyslog.d'
        $service = 'rsyslog'
    } else {
        $base = "/etc/rsyslog-${instance}/conf.d"
        $service = "rsyslog-${instance}"
    }

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

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