summaryrefslogtreecommitdiff
path: root/example/site_check_mk/manifests/agent/logwatch.pp
blob: 423cace26470f95d36f968e9911de5866598a893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class site_check_mk::agent::logwatch {
  # Deploy mk_logwatch 1.2.4 so we can split the config
  # into multiple config files in /etc/check_mk/logwatch.d
  # see https://leap.se/code/issues/5135

  file { '/usr/lib/check_mk_agent/plugins/mk_logwatch':
    source  => 'puppet:///modules/site_check_mk/agent/plugins/mk_logwatch.1.2.4',
    mode    => '0755',
    require => Package['check-mk-agent-logwatch']
  }

  # only config files that watch a distinct logfile should go in logwatch.d/
  file { '/etc/check_mk/logwatch.d':
    ensure  => directory,
    recurse => true,
    purge   => true,
    require => Package['check-mk-agent-logwatch']
  }

  # service that share a common logfile (i.e. /var/log/syslog) need to get
  # concanated in one file, otherwise the last file sourced will override
  # the config before
  # see mk_logwatch: "logwatch.cfg overwrites config files in logwatch.d",
  # https://leap.se/code/issues/5155

  # first, we need to deploy a custom logwatch.cfg that doesn't include
  # a section about /var/log/syslog

  file { '/etc/check_mk/logwatch.cfg':
    source  => 'puppet:///modules/site_check_mk/agent/logwatch/logwatch.cfg',
    require => Package['check_mk-agent-logwatch']
  }

  include concat::setup
  include site_check_mk::agent::logwatch::syslog
}