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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'manifests/client.pp', line 8
class loki::client (
String $server,
String $password,
Hash[String, String] $logpaths = {},
Array[String] $syslog_sources = [],
String $journald_retention = '0',
) {
include loki
package { 'promtail': }
-> file { '/etc/loki':
ensure => directory,
owner => root,
group => root,
mode => '0755',
}
-> file { '/etc/loki/promtail.yaml':
ensure => file,
content => template('loki/promtail.yaml.erb'),
}
~> service { 'promtail':
ensure => running,
enable => true,
}
file { '/etc/systemd/journald.conf.d':
ensure => directory,
owner => root,
group => root,
mode => '0755',
}
file { '/etc/systemd/journald.conf.d/rotate.conf':
ensure => file,
content => template('loki/rotate.conf.erb'),
}
if $syslog_sources.length > 0 {
$syslog_sources.each |String $source| {
firewall { "100 allow syslog udp input from ${source}":
dport => 514,
source => $source,
proto => 'udp',
action => 'accept',
}
}
package { 'syslog-ng': }
-> file { '/etc/syslog-ng/syslog-ng.conf':
ensure => file,
source => 'puppet:///modules/loki/syslog-ng.conf',
}
~> service { 'syslog-ng@default':
ensure => running,
enable => true,
}
}
}
|