/var/log/syslog not getting rotated

I have a fresh install of ubuntu 20.04. I have set daily rotation in /etc/logrotate.d/rsyslog file with a maxsize of 1M but the /var/log/syslog and kern.log file keeps increasing. Here is the rsyslog and /etc/logrotate.conf configuration.


rsyslog file

/var/log/syslog
{
    rotate 4
    maxsize 1M
    daily
    missingok
    notifempty
    compress
    delaycompress
#   create 640 root adm
    postrotate
        /usr/lib/rsyslog/rsyslog-rotate
#       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
    daily
    missingok
    notifempty
    compress
    delaycompress
    sharedscripts
    postrotate
        /usr/lib/rsyslog/rsyslog-rotate
    endscript
}

Logrotate.conf file

rotate log files weekly
#weekly
daily

# use the adm group by default, since this is the owning group
# of /var/log/syslog.
su root adm
# su root syslog
# size 3M
# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
#dateext

# uncomment this if you want your log files compressed
#compress
# compress
# packages drop log rotation information into this directory
include /etc/logrotate.d

# system-specific logs may be also be configured here.
#/var/log/syslog {
#   size 1M
#   rotate 4
#   daily
#   missingok
#   notifempty
#   delaycompress
#   compress
#   postrotate
#       invoke-rc.d rsyslog reload > /dev/null
#   endscript   
#}

Any help would be appreciated.

Edit: Thanks. Here is the output.

$ logrotate --debug /etc/logrotate.conf
WARNING: logrotate in debug mode does nothing except printing debug messages!  Consider using verbose mode (-v) instead if this is not what you want.

reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file alternatives
reading config file apport
reading config file apt
reading config file bootlog
reading config file btmp
reading config file cups-daemon
reading config file dpkg
reading config file ppp
reading config file rsyslog
reading config file speech-dispatcher
reading config file ubuntu-advantage-tools
reading config file ufw
reading config file unattended-upgrades
reading config file wtmp
Reading state from file: /var/lib/logrotate/status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state

Handling 17 logs

rotating pattern: /var/log/alternatives.log  monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/apport.log  after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/apt/term.log  monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/apt/history.log  monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/boot.log
 after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/btmp  monthly (1 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/cups/*log  after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/dpkg.log  monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/ppp-connect-errors  weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/syslog
 weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /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
 weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/speech-dispatcher/speech-dispatcher.log /var/log/speech-dispatcher/speech-dispatcher-protocol.log  after 1 days (7 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/speech-dispatcher/debug-epos-generic /var/log/speech-dispatcher/debug-festival /var/log/speech-dispatcher/debug-flite  after 1 days (2 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/ubuntu-advantage.log  monthly (6 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/ufw.log
 weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/unattended-upgrades/unattended-upgrades.log 
/var/log/unattended-upgrades/unattended-upgrades-dpkg.log
/var/log/unattended-upgrades/unattended-upgrades-shutdown.log
 monthly (6 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

rotating pattern: /var/log/wtmp  monthly (1 rotations)
empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed
switching euid to 0 and egid to 4
error: error switching euid to 0 and egid to 4: Operation not permitted

Solution 1:

The issue got resolved. After searching internet, I came across a post https://forums.linuxmint.com/viewtopic.php?t=324733 which gave me an idea about the possibility of logrotate.timer not getting executed.

I searched and found that the logrotate timer is set to once a day at 12h (midnight) at which time my computer is off so it may not be executing logrotate.service. I copied the timer setting from anacron.timerand made it run every hour. Apart from I also granted /etc/logrotate.d folder 755 permission and all files inside that folder 644 permission (it may have been there earlier but I suspect that it might have got changed while experimenting). Logrotate.service also checks that computer must be on AC power. Making the setting as false leads to other issue of timer not getting executed on AC power. So I kept it unchanged.

Post this change auto log-rotation is happening as per schedule.