log rotation

RobFantini

Famous Member
May 24, 2012
2,022
107
133
Boston,Mass
For some reason on PVE and Nextcloud and other systems log rotation came to a halt in November. /var/log had over 7G . /var/log/journal had 4G

i think it has something to do with a conflict with rsyslog and systemd journal stuff. will check later

to fix edit
/etc/cron.daily/logrotate

Code:
# skip in favour of systemd timer
#
# 2023-01-12  logs had not been rotated in a month
#   i did not see a systemd log rotate timer
#   so commented this out so it will run here
#
# 2023-01-13 more detail.  i had started logrotate.timer  . on reboot was dead:
# root@nextcloud:[~]:#  systemctl status logrotate.timer   
#● logrotate.timer - Daily rotation of log files
#     Loaded: loaded (/lib/systemd/system/logrotate.timer; disabled; vendor preset: enabled)
#     Active: inactive (dead)

###    COMMENT OUT THESE 3 LINES  so that logrotate will work from good old regular cron.
#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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!