/var/log/syslog not rotating

24,666

Solution 1

I found the problem, somehow su directive got removed from /etc/logrotate.conf, so needed to add:

# use the syslog group by default, since this is the owning group
# of /var/log/syslog.
su root syslog

Solution 2

I had a similar problem and it seems to have been caused by some kind of incompatibility between the logrotate configuration and the new systemd replacement for sysv/init.d

I had to edit the /etc/logrotate.d/rsyslog and replace

invoke-rc.d rsyslog rotate > /dev/null

with

systemctl kill -s HUP --kill-who=main rsyslog.service

the previous line looked like it was working, and said so, but did not manage to get rsyslog to reopen its logfiles.

Share:
24,666

Related videos on Youtube

Justin
Author by

Justin

Updated on September 18, 2022

Comments

  • Justin
    Justin over 1 year

    Our log file /var/log/syslog does not seem to be rotating, even though the logrotate config /etc/logrotate.d/rsyslog exists:

    /var/log/syslog
    {
        rotate 7
        daily
        missingok
        notifempty
        delaycompress
        compress
        postrotate
            reload rsyslog >/dev/null 2>&1 || true
        endscript
    }
    
    /var/log/mail.info
    /var/log/mail.warn
    /var/log/mail.err
    /var/log/mail.log
    /var/log/daemon.log
    /var/log/kern.log
    /var/log/auth.log
    /var/log/user.log
    /var/log/lpr.log
    /var/log/cron.log
    /var/log/debug
    /var/log/messages
    {
        rotate 4
        weekly
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
            reload rsyslog >/dev/null 2>&1 || true
        endscript
    }
    

    See, the syslog log file is 600M with no old files or compressed.

    -rw-r-----  1 syslog   adm    600M Nov  9 20:30 syslog
    
  • Samuel Åslund
    Samuel Åslund over 4 years
    What system are you running? I did not find that file on my Ubuntu 16.04 LTS
  • Matteljay
    Matteljay over 4 years
    Ubuntu 18.04.3 LTS, kernel 4.15.18-21-pve x86_64