From dc5b9ec7c891ebeb23ec43de5cf0158e2ef378eb Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 1 Apr 2021 09:21:17 +0200 Subject: [PATCH] systemvm: remove logrotate config for wtmp and btmp (#4872) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit logrotate in systemvms run every day. it exits with failure. ``` root@r-100-VM:~# systemctl status logrotate ● logrotate.service - Rotate log files Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2021-03-23 00:00:01 UTC; 2 days ago Docs: man:logrotate(8) man:logrotate.conf(5) Process: 25001 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=1/FAILURE) Main PID: 25001 (code=exited, status=1/FAILURE) Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable. ``` it is because the logrotate for wtmp and btmp already exist in 4.15 systemvm template. ``` root@r-100-VM:~# cat /etc/logrotate.d/wtmp /var/log/wtmp { missingok monthly create 0664 root utmp minsize 1M rotate 1 } root@r-100-VM:~# cat /etc/logrotate.d/btmp /var/log/btmp { missingok monthly create 0660 root utmp rotate 1 } ``` remove them from /etc/logrotate.conf fixes the issue. ``` root@r-100-VM:~# systemctl status logrotate ● logrotate.service - Rotate log files Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled) Active: inactive (dead) since Thu 2021-03-25 00:00:01 UTC; 9h ago Docs: man:logrotate(8) man:logrotate.conf(5) Process: 28211 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS) Main PID: 28211 (code=exited, status=0/SUCCESS) Mar 25 00:00:01 r-100-VM systemd[1]: Starting Rotate log files... Mar 25 00:00:01 r-100-VM systemd[1]: logrotate.service: Succeeded. Mar 25 00:00:01 r-100-VM systemd[1]: Started Rotate log files. ``` --- systemvm/debian/etc/logrotate.conf | 12 ------------ systemvm/debian/etc/logrotate.d/btmp | 7 +++++++ systemvm/debian/etc/logrotate.d/wtmp | 8 ++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 systemvm/debian/etc/logrotate.d/btmp create mode 100644 systemvm/debian/etc/logrotate.d/wtmp diff --git a/systemvm/debian/etc/logrotate.conf b/systemvm/debian/etc/logrotate.conf index d213d4e9ce8..d33f2dae2e6 100644 --- a/systemvm/debian/etc/logrotate.conf +++ b/systemvm/debian/etc/logrotate.conf @@ -11,15 +11,3 @@ size 50M compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d -# no packages own wtmp and btmp -- we'll rotate them here -/var/log/wtmp { - monthly - create 0664 root utmp - rotate 1 -} -/var/log/btmp { - missingok - monthly - create 0600 root utmp - rotate 1 -} diff --git a/systemvm/debian/etc/logrotate.d/btmp b/systemvm/debian/etc/logrotate.d/btmp new file mode 100644 index 00000000000..0aa1ae1ade1 --- /dev/null +++ b/systemvm/debian/etc/logrotate.d/btmp @@ -0,0 +1,7 @@ +# no packages own btmp -- we'll rotate it here +/var/log/btmp { + missingok + monthly + create 0660 root utmp + rotate 1 +} diff --git a/systemvm/debian/etc/logrotate.d/wtmp b/systemvm/debian/etc/logrotate.d/wtmp new file mode 100644 index 00000000000..cc8a151e00b --- /dev/null +++ b/systemvm/debian/etc/logrotate.d/wtmp @@ -0,0 +1,8 @@ +# no packages own wtmp -- we'll rotate it here +/var/log/wtmp { + missingok + monthly + create 0664 root utmp + minsize 1M + rotate 1 +}