Skip to content

Commit fd4ea3f

Browse files
committed
(hiera/common.yaml) add rsyslog log rotate
1 parent 9b38772 commit fd4ea3f

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

hieradata/common.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,29 @@ rsyslog::config::inputs:
330330
file: "/var/log/audit/audit.log"
331331
Tag: "auditd"
332332

333+
files:
334+
/etc/logrotate.d/rsyslog:
335+
ensure: 'file'
336+
owner: 'root'
337+
group: 'root'
338+
mode: '0644'
339+
content: |
340+
/var/log/cron
341+
/var/log/maillog
342+
/var/log/messages
343+
/var/log/secure
344+
/var/log/spooler
345+
{
346+
size 50M
347+
rotate 4
348+
compress
349+
delaycompress
350+
missingok
351+
sharedscripts
352+
postrotate
353+
/usr/bin/systemctl -s HUP kill rsyslog.service >/dev/null 2>&1 || true
354+
endscript
355+
}
333356
yum::plugin::versionlock::clean: true # trigger `yum clean all`
334357
yum::manage_os_default_repos: true
335358

spec/support/spec/rsyslog.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,33 @@
7474
)
7575
end
7676

77+
it do
78+
is_expected.to contain_file('/etc/logrotate.d/rsyslog').with(
79+
ensure: 'file',
80+
owner: 'root',
81+
group: 'root',
82+
mode: '0644',
83+
content: <<~CONTENT,
84+
/var/log/cron
85+
/var/log/maillog
86+
/var/log/messages
87+
/var/log/secure
88+
/var/log/spooler
89+
{
90+
size 50M
91+
rotate 4
92+
compress
93+
delaycompress
94+
missingok
95+
sharedscripts
96+
postrotate
97+
/usr/bin/systemctl -s HUP kill rsyslog.service >/dev/null 2>&1 || true
98+
endscript
99+
}
100+
CONTENT
101+
)
102+
end
103+
77104
case site
78105
when 'cp'
79106
it do

0 commit comments

Comments
 (0)