Skip to content

Commit f28790c

Browse files
authored
[System logs]: Fix logrotate bugs (#535)
- rsyslog logs were being rotated regardless of whether they exceeded their maixmum size. This was due to "-f" flag passed to logrotate in cron job. - After rotation, /var/log/syslog was never written to again. Instead, logs were written to /var/log/syslog.1. This was due to rsyslog not properly closing the file descriptor to the pre-rotated log. - Also brought back time-related rotation via the new(er) maxsize option, which performs a boolean OR operation. If the log exceeds the maxsize OR the log hasn't been rotated in the specified, it will be rotated. Using the older size option, the time-based rotation was ignored. - Also addresses issue #528
1 parent 34adb71 commit f28790c

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

files/image_config/cron.d/logrotate

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Attempt to rotate system logs once per minute
2-
* * * * * root /usr/sbin/logrotate -f /etc/logrotate.d/rsyslog
2+
* * * * * root /usr/sbin/logrotate /etc/logrotate.d/rsyslog
33

files/image_config/logrotate.d/rsyslog

+13-7
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
/var/log/teamd.log
44
{
55
rotate 7
6-
# Removed 'daily' interval, as we now call logrotate more frequently via cron
7-
# and we want to check these logs every time
8-
# daily
9-
size 100M
6+
daily
7+
maxsize 100M
108
missingok
119
notifempty
1210
compress
1311
delaycompress
1412
postrotate
15-
invoke-rc.d rsyslog rotate > /dev/null
13+
# Calling kill directly instead of 'service rsyslog rotate >/dev/null' due
14+
# to bug in init-system-helpers. Bug has apparently been fixed in v1.47.
15+
# However, Debian Jessie is still using v1.22.
16+
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218
17+
kill -HUP $(cat /var/run/rsyslogd.pid)
1618
endscript
1719
}
1820
/var/log/mail.info
@@ -30,14 +32,18 @@
3032
{
3133
rotate 4
3234
weekly
33-
size 100M
35+
maxsize 100M
3436
missingok
3537
notifempty
3638
compress
3739
delaycompress
3840
sharedscripts
3941
postrotate
40-
invoke-rc.d rsyslog rotate > /dev/null
42+
# Calling kill directly instead of 'service rsyslog rotate >/dev/null' due
43+
# to bug in init-system-helpers. Bug has apparently been fixed in v1.47.
44+
# However, Debian Jessie is still using v1.22.
45+
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218
46+
kill -HUP $(cat /var/run/rsyslogd.pid)
4147
endscript
4248
}
4349

files/image_config/systemd/journald.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#SyncIntervalSec=5m
1616
#RateLimitInterval=30s
1717
#RateLimitBurst=1000
18-
SystemMaxUse=50MB
18+
SystemMaxUse=50M
1919
#SystemKeepFree=
2020
#SystemMaxFileSize=
21-
RuntimeMaxUse=50MB
21+
RuntimeMaxUse=50M
2222
#RuntimeKeepFree=
2323
#RuntimeMaxFileSize=
2424
#MaxRetentionSec=

0 commit comments

Comments
 (0)