Puppet Class: icinga2::feature::syslog

Defined in:
manifests/feature/syslog.pp

Summary

Configures the Icinga 2 feature syslog.

Overview

Parameters:

  • ensure (Enum['absent', 'present']) (defaults to: present)

    Set to present enables the feature syslog, absent disables it.

  • severity (Icinga::LogLevel) (defaults to: 'warning')

    You can choose the log severity between information, notice, warning or debug.

  • facility (Optional[Icinga2::LogFacility]) (defaults to: undef)

    Defines the facility to use for syslog entries. This can be a facility constant like FacilityDaemon.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'manifests/feature/syslog.pp', line 14

class icinga2::feature::syslog (
  Enum['absent', 'present']        $ensure   = present,
  Icinga::LogLevel                 $severity = 'warning',
  Optional[Icinga2::LogFacility]   $facility = undef,
) {
  if ! defined(Class['icinga2']) {
    fail('You must include the icinga2 base class before using any icinga2 feature class!')
  }

  $conf_dir  = $icinga2::globals::conf_dir
  $_notify   = $ensure ? {
    'present' => Class['icinga2::service'],
    default   => undef,
  }

  # compose attributes
  $attrs = {
    'severity' => $severity,
    'facility' => $facility,
  }

  # create object
  icinga2::object { 'icinga2::object::SyslogLogger::syslog':
    object_name => 'syslog',
    object_type => 'SyslogLogger',
    attrs       => delete_undef_values($attrs),
    attrs_list  => keys($attrs),
    target      => "${conf_dir}/features-available/syslog.conf",
    order       => 10,
    notify      => $_notify,
  }

  # manage feature
  icinga2::feature { 'syslog':
    ensure => $ensure,
  }
}