-
Notifications
You must be signed in to change notification settings - Fork 216
Description
Noticing an issue with logrotate 3.18.0 on Ubuntu 21.10
Update: replicated the issue on logrotate 3.19.0 on Ubuntu 22.04
Expectation:
Using option copy or copytruncate the original file "firewall.log" is copied to "firewall.log.1" and then "firewall.log" is truncated in case of using copytruncate.
What happens:
The original file is not copied, but truncated in case of copytruncate. No errors indicate any problems during copy action in logrotate output.
Using the following configuration:
su root syslog
daily
ifempty
missingok
/var/log/test/firewall.log {
nocreate
nocompress
copytruncate
postrotate
DATUM=$(/bin/date +%Y-%m-%dT%H%M)
/bin/mv /var/log/test/firewall.log.1 /var/log/test/archive/firewall.log.$DATUM
/bin/gzip /var/log/test/archive/firewall.log.$DATUM -f9
endscript
}
Partial output of "logrotate -vf /root/test_logrotate.conf":
considering log /var/log/test/firewall.log
Now: 2022-04-28 12:37
Last rotated at 2022-04-28 12:37
log needs rotating
rotating log /var/log/test/firewall.log, log->rotateCount is 0
dateext suffix '-20220428'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/test/firewall.log.1 to /var/log/test/firewall.log.2 (rotatecount 1, logstart 1, i 1),
old log /var/log/test/firewall.log.1 does not exist
renaming /var/log/test/firewall.log.0 to /var/log/test/firewall.log.1 (rotatecount 1, logstart 1, i 0),
old log /var/log/test/firewall.log.0 does not exist
log /var/log/test/firewall.log.2 doesn't exist -- won't try to dispose of it
copying /var/log/test/firewall.log to /var/log/test/firewall.log.1
truncating /var/log/test/firewall.log
running postrotate script
switching euid from 0 to 0 and egid from 110 to 0 (pid 1286346)
/bin/mv: cannot stat '/var/log/test/firewall.log.1': No such file or directory
gzip: /var/log/test/archive/firewall.log.2022-04-28T1237: No such file or directory
error: error running non-shared postrotate script for /var/log/test/firewall.log of '/var/log/test/firewall.log '
switching euid from 0 to 0 and egid from 110 to 0 (pid 1286345)
This config has been working flawlessly for many years on many other systems, and I can not see any differences when it comes to file permissions in /var/log*.
Do you have an idea what might be causing this?