[SOLVED] How to let logrotate handle PBS log?

Ovidiu

Renowned Member
Apr 27, 2014
324
12
83
The log directory seems to be getting out of hand so I was wondering if anyone could share his logrotate config?

Code:
/var/log# du -cksh proxmox-backup/*
20M     proxmox-backup/api
7.0M    proxmox-backup/tasks
27M     total
 
hi,

api access logs should be rotated already.

you can uncomment the compress option in /etc/logrotate.conf or change the rotation period from weekly to daily

you can also add a cronjob like this:

Code:
find /var/log/proxmox/backup -mtime +10 -type f -print -exec rm {} +

to delete files older than 10 days (change +10 to +n for n days)

hope this helps!
 
that does not seem to be the case - this is a Debian 10 system with a manually installed PBS (not via the .iso) => https://pbs.proxmox.com/docs/installation.html#install-proxmox-backup-server-on-debian

Code:
cat /var/lib/logrotate/status
logrotate state -- version 2
"/var/log/syslog" 2021-4-14-0:0:21
"/var/log/dpkg.log" 2021-4-1-0:42:24
"/var/log/auth.log" 2021-4-11-0:0:21
"/var/log/apt/term.log" 2021-4-1-0:42:24
"/var/log/apt/history.log" 2021-4-1-0:42:24
"/var/log/netdata/error.log" 2021-4-14-0:0:21
"/var/log/alternatives.log" 2021-4-13-0:0:21
"/var/log/mail.log" 2021-4-11-0:0:21
"/var/log/debug" 2021-4-11-0:0:21
"/var/log/kern.log" 2021-4-11-0:0:21
"/var/log/ufw.log" 2021-4-11-0:0:21
"/var/log/daemon.log" 2021-4-11-0:0:21
"/var/log/wtmp" 2021-1-17-0:0:0
"/var/log/mail.warn" 2021-4-11-0:0:21
"/var/log/netdata/access.log" 2021-4-14-0:0:21
"/var/log/btmp" 2021-4-1-0:42:24
"/var/log/mail.err" 2021-1-17-0:0:0
"/var/log/lpr.log" 2021-1-17-0:0:0
"/var/log/user.log" 2021-4-13-0:0:21
"/var/log/netdata/debug.log" 2021-4-13-0:0:0
"/var/log/mail.info" 2021-4-11-0:0:21
"/var/log/cron.log" 2021-1-17-0:0:0
"/var/log/messages" 2021-4-11-0:0:21
 
hi,

api logfiles are rotated automatically by backup server.

but if you want, you can make a new file in /etc/logrotate.d/proxmox:
Code:
/var/log/proxmox-backup/api/*.log {
    rotate 4
    weekly
    compress
    missingok
    notifempty
}
 
  • Like
Reactions: Ovidiu
ah, I see, that seems to be the case, thanks for pointing it out. I guess eventually the old ones will be deleted. I was just wondering since auth.log seems to go back till the 3rd of February

Code:
ls -al /var/log/proxmox-backup/api/
total 20205
drwxr-xr-x 2 backup backup       18 Apr 12 00:00 .
drwxr-xr-x 4 backup backup        4 Jan 16 16:33 ..
-rw-r--r-- 1 backup backup 22348558 Apr 14 14:15 access.log
-rw-r--r-- 1 backup backup 36056787 Apr 11 23:59 access.log.1
-rw-r--r-- 1 backup backup  1025986 Mar  6 00:00 access.log.10.zst
-rw-r--r-- 1 backup backup   836412 Mar  4 00:00 access.log.11.zst
-rw-r--r-- 1 backup backup   893927 Feb 28 00:00 access.log.12.zst
-rw-r--r-- 1 backup backup  1115582 Feb 26 00:00 access.log.13.zst
-rw-r--r-- 1 backup backup   787840 Apr 12 00:00 access.log.2.zst
-rw-r--r-- 1 backup backup   849597 Apr  6 00:00 access.log.3.zst
-rw-r--r-- 1 backup backup   944525 Apr  1 00:44 access.log.4.zst
-rw-r--r-- 1 backup backup   647190 Mar 30 00:00 access.log.5.zst
-rw-r--r-- 1 backup backup  1061852 Mar 22 00:00 access.log.6.zst
-rw-r--r-- 1 backup backup   756971 Mar 18 00:00 access.log.7.zst
-rw-r--r-- 1 backup backup   837908 Mar 14 00:00 access.log.8.zst
-rw-r--r-- 1 backup backup   832249 Mar  8 00:00 access.log.9.zst
-rw-r--r-- 1 backup backup 31381460 Apr 14 13:04 auth.log
-rw-r--r-- 1 backup backup 34448781 Feb  2 23:59 auth.log.1
 
hi,

api logfiles are rotated automatically by backup server.

but if you want, you can make a new file in /etc/logrotate.d/proxmox:
Code:
/var/log/proxmox-backup/api/*.log {
    rotate 4
    weekly
    compress
    missingok
    notifempty
}
But where does one stop the original rotation from happening?
 
  • Like
Reactions: aasami

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!