Skip to content

Commit

Permalink
add rotation setting
Browse files Browse the repository at this point in the history
  • Loading branch information
akerl committed Jan 4, 2024
1 parent d63f6da commit 00efa60
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
# @param password sets the promtail user password to submit logs
# @param logpaths sets additional directories to pull logs from
# @param syslog_sources sets IPs to expect syslog data from
# @param journald_retention sets how long to retain local journal data
class loki::client (
String $server,
String $password,
Hash[String, String] $logpaths = {},
Array[String] $syslog_sources = [],
String $journald_retention = '0',
) {
include loki

Expand All @@ -31,6 +33,18 @@
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}":
Expand Down
2 changes: 2 additions & 0 deletions templates/rotate.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Journal]
MaxRetentionSec=<%= @journald_retention %>

0 comments on commit 00efa60

Please sign in to comment.