Andrei Borzenkov wrote:
On Mon, Apr 24, 2023 at 11:48 AM Per Jessen <per@opensuse.org> wrote:
Andrei Borzenkov wrote:
On Mon, Apr 24, 2023 at 11:04 AM Per Jessen <per@opensuse.org> wrote:
Wrt $SUBJ - my logrotate changes didn't work. I created a /etc/logrotate.d/syslog with new definitions for /var/log/messages and /var/log/mail, but it seems it was ignored.
Were those definitions in /usr/etc/logrotate.d/syslog?
Yes, /usr/etc/logrotate.d/syslog has definitions for a lot of log files [1], including those two. I thought I would be able to override with
Let's start from the beginning.
How are you running logrotate? Is it the default logrotate.timer which calls logrotate.service? Do you have your own cron job or something else?
Excluding my attempted change for /var/log/message and /var/log/mail, everything is installation default. On a systemd timer and it works. (I mean, it was triggered). office24:/etc # systemctl status logrotate.timer ● logrotate.timer - Daily rotation of log files Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; enabled; preset: enabled) Active: active (waiting) since Sun 2023-04-23 17:52:48 CEST; 17h ago Trigger: Tue 2023-04-25 00:00:00 CEST; 12h left Triggers: ● logrotate.service Docs: man:logrotate(8) man:logrotate.conf(5) Apr 23 17:52:48 office24 systemd[1]: Started Daily rotation of log files. office24:/etc # systemctl status logrotate.service ○ logrotate.service - Rotate log files Loaded: loaded (/usr/lib/systemd/system/logrotate.service; static) Active: inactive (dead) since Mon 2023-04-24 00:00:45 CEST; 11h ago TriggeredBy: ● logrotate.timer Docs: man:logrotate(8) man:logrotate.conf(5) Process: 2161 ExecStart=/usr/sbin/logrotate-all (code=exited, status=0/SUCCESS) Main PID: 2161 (code=exited, status=0/SUCCESS) CPU: 145ms Apr 24 00:00:45 office24 systemd[1]: Starting Rotate log files... Apr 24 00:00:45 office24 systemd[1]: logrotate.service: Deactivated successfully. Apr 24 00:00:45 office24 systemd[1]: Finished Rotate log files. I'm a little bit surprised about the 45second delay, but for this it doesn't matter.
Do you have /etc/logrotate.conf? Does it explicitly include any files?
No, there is only /etc/logrotate.d with two files, mcelog and my new syslog. office24:/etc # l logrotate.d/ total 32 drwxr-xr-x 2 root root 4096 Apr 24 09:51 ./ drwxr-xr-x 98 root root 8192 Apr 24 10:08 ../ -rw-r--r-- 1 root root 267 Mar 20 06:02 mcelog -rw-r--r-- 1 root root 238 Apr 23 18:00 syslog
How do you test your modifications? Are you calling logrotate manually? If yes, how exactly?
To be honest, I didn't test them :-) I do this modification on every new install, hopefully I know it by now. I'll look up how to to run a test run. -- Per Jessen, Zürich (9.4°C) Member, openSUSE Heroes (2016 - present) We're hiring - https://en.opensuse.org/openSUSE:Heroes