On 2019-09-18 12:52:32 +0200, Christian Göttsche wrote:
> Please share your current setup:
> Debian version: (old-stable | stable | testing | unstable)

unstable

> Logrotate version: (logrotate --version)

logrotate 3.15.1

    Default mail command:       /usr/bin/mail
    Default compress command:   /bin/gzip
    Default uncompress command: /bin/gunzip
    Default compress extension: .gz
    Default state file path:    /var/lib/logrotate/status
    ACL support:                yes
    SELinux support:            yes

> Please share your cronjob config '/etc/cron.daily/logrotate'

#!/bin/sh

# skip in favour of systemd timer
if [ -d /run/systemd/system ]; then
    exit 0
fi

# this cronjob persists removals (but not purges)
if [ ! -x /usr/sbin/logrotate ]; then
    exit 0
fi

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit $EXITVALUE

(This is the default one.)

> Are you using systemd?

Yes, this machine does.

>     If yes, please share 'systemctl status logrotate.timer' and
> 'journalctl -u logrotate' (the most recent part of it).

● logrotate.timer - Daily rotation of log files
   Loaded: loaded (/lib/systemd/system/logrotate.timer; enabled; vendor preset: 
enabled)
   Active: active (waiting) since Thu 2019-09-19 10:25:10 CEST; 32min ago
  Trigger: Fri 2019-09-20 00:00:00 CEST; 13h left
     Docs: man:logrotate(8)
           man:logrotate.conf(5)

Sep 19 10:25:10 cventin systemd[1]: Started Daily rotation of log files.

[...]
Sep 16 00:00:01 cventin systemd[1]: Starting Rotate log files...
Sep 16 00:00:02 cventin systemd[1]: logrotate.service: Succeeded.
Sep 16 00:00:02 cventin systemd[1]: Started Rotate log files.
Sep 17 00:00:01 cventin systemd[1]: Starting Rotate log files...
Sep 17 00:00:03 cventin systemd[1]: logrotate.service: Succeeded.
Sep 17 00:00:03 cventin systemd[1]: Started Rotate log files.
Sep 18 00:00:01 cventin systemd[1]: Starting Rotate log files...
Sep 18 00:00:01 cventin logrotate[16206]: error: Compressing program wrote 
following message to stderr when compressing log /var/log/apache2/error.log.1:
Sep 18 00:00:01 cventin logrotate[16206]: gzip: stdin: warning: file timestamp 
out of range for gzip format
Sep 18 00:00:01 cventin logrotate[16206]: error: failed to compress log 
/var/log/apache2/error.log.1
Sep 18 00:00:02 cventin systemd[1]: logrotate.service: Main process exited, 
code=exited, status=1/FAILURE
Sep 18 00:00:02 cventin systemd[1]: logrotate.service: Failed with result 
'exit-code'.
Sep 18 00:00:02 cventin systemd[1]: Failed to start Rotate log files.
Sep 19 00:00:01 cventin systemd[1]: Starting Rotate log files...
Sep 19 00:00:02 cventin logrotate[19728]: error: Compressing program wrote 
following message to stderr when compressing log /var/log/apache2/error.log.1:
Sep 19 00:00:02 cventin logrotate[19728]: gzip: stdin: warning: file timestamp 
out of range for gzip format
Sep 19 00:00:02 cventin logrotate[19728]: error: failed to compress log 
/var/log/apache2/error.log.1
Sep 19 00:00:02 cventin systemd[1]: logrotate.service: Main process exited, 
code=exited, status=1/FAILURE
Sep 19 00:00:02 cventin systemd[1]: logrotate.service: Failed with result 
'exit-code'.
Sep 19 00:00:02 cventin systemd[1]: Failed to start Rotate log files.

> > It seems really broken, worse than expected. First, I did not get
> > any error via cron, and the error logs did not change:
> >
> > -rw-r----- 1 root adm 306 1904-01-01 00:00:00 error.log
> > -rw-r----- 1 root adm 440 1904-01-01 00:00:00 error.log.1
> > -rw-r----- 1 root adm 271 2019-09-16 00:00:02 error.log.2.gz
> > -rw-r----- 1 root adm 269 2019-09-15 00:00:02 error.log.3.gz
> > -rw-r----- 1 root adm 271 2019-09-14 00:00:02 error.log.4.gz
> > -rw-r----- 1 root adm 271 2019-09-13 00:00:01 error.log.5.gz
> > [...]
> 
> That the logs do not change is expected, as gzip failed;
> if you using systemd you should see some error messages in the journal.

Yes, this is the case. But cron should have sent a mail with these
error messages, and I haven't received such a mail.

> > Worse, this seemed to have interrupted the rotation of the
> > access logs (or is this a different bug?):
> >
> > -rw-r----- 1 root adm 308 2019-09-17 16:39:00 access.log
> > -rw-r----- 1 root adm 156 2019-09-16 16:31:06 access.log.2.gz
> > -rw-r----- 1 root adm 157 2019-09-13 12:36:03 access.log.3.gz
> > -rw-r----- 1 root adm 155 2019-09-12 12:25:14 access.log.4.gz
> > -rw-r----- 1 root adm 156 2019-09-10 10:33:38 access.log.5.gz
> > [...]
> 
> This is indeed unexpected, in my tests logrotate continues to rotate
> other logs. (see https://paste.debian.net/1101399/)

It is only access.log that it doesn't rotate. After last night:

-rw-r----- 1 root adm 308 2019-09-17 16:39:00 access.log
-rw-r----- 1 root adm 156 2019-09-16 16:31:06 access.log.3.gz
-rw-r----- 1 root adm 157 2019-09-13 12:36:03 access.log.4.gz
-rw-r----- 1 root adm 155 2019-09-12 12:25:14 access.log.5.gz
-rw-r----- 1 root adm 156 2019-09-10 10:33:38 access.log.6.gz

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to