-
Notifications
You must be signed in to change notification settings - Fork 289
/
Copy pathlogging.pp
51 lines (45 loc) · 1.37 KB
/
logging.pp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Sensu Go docs: https://docs.sensu.io/sensu-go/latest/guides/systemd-logs/
include sensu::backend
include sensu::agent
include rsyslog::client
class { 'systemd':
journald_settings => { 'ForwardToSyslog' => 'yes' },
}
rsyslog::snippet { '99-sensu-backend':
ensure => 'present',
content => join([
'if $programname == "sensu-backend" then {',
' /var/log/sensu/sensu-backend.log',
' ~',
'}',
], "\n"),
}
rsyslog::snippet { '99-sensu-agent':
ensure => 'present',
content => join([
'if $programname == "sensu-agent" then {',
' /var/log/sensu/sensu-agent.log',
' ~',
'}',
], "\n"),
}
logrotate::rule { 'sensu-backend':
path => '/var/log/sensu/sensu-backend.log',
rotate_every => 'day',
rotate => 7,
size => '100M',
compress => true,
delaycompress => true,
# Adjust PID file path. Following example works for CentOS/RHEL
postrotate => '/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true',
}
logrotate::rule { 'sensu-agent':
path => '/var/log/sensu/sensu-agent.log',
rotate_every => 'day',
rotate => 7,
size => '100M',
compress => true,
delaycompress => true,
# Adjust PID file path. Following example works for CentOS/RHEL
postrotate => '/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true',
}