[SOLVED] How does task-log-max-days work?

megabit

New Member
Jan 14, 2025
4
0
1
Hello,

What are the conditions for the task-log-max-days parameter to work? I tried setting the period to 1 day. But the log still remains. These are the settings and version now
Code:
root@pbs-test:~# proxmox-backup-manager versions
proxmox-backup-server 3.3.2-1 running version: 3.3.2

root@pbs-test:~# proxmox-backup-manager node show
┌───────────────────┬──────────────────────┐
│ Name              │ Value                │
╞═══════════════════╪══════════════════════╡
│ acme              │ account=default      │
├───────────────────┼──────────────────────┤
│ acmedomain0       │ hidden               │
├───────────────────┼──────────────────────┤
│ task-log-max-days │ 1                    │
└───────────────────┴──────────────────────┘

root@pbs-test:~# tail -n1 /etc/proxmox-backup/node.cfg
task-log-max-days: 1

But with these settings, logs that are more than 1 day old still remain.

Code:
root@pbs-test:~# ls -la /var/log/proxmox-backup/tasks/FB/
total 112
drwxr-xr-x  2 backup backup   4096 Jan 10 18:00  .
drwxr-xr-x 12 backup backup   4096 Jan 14 17:55  ..
-rw-r--r--  1 backup backup 101982 Jan 10 17:57 'UPID:pbs-test:000002A5:000002FB:00000000:67814334:backup:datastore1\x3avm-test\x2d55474:root@pam!test:'
-rw-r--r--  1 backup backup    353 Jan 10 18:00 'UPID:pbs-test:000002A5:000002FB:00000001:67814400:prunejob:datastore1\x3areinstalled:root@pam:'

I have also tried putting 30 days out and the result is the same. Logs that were more than 30 days old were not cleared either.
 
Hi,
this setting will only be used by the next scheduled log rotation task, not instantly. The log rotate is triggered at midnight, so you will have to wait for that to happen.
 
But it is not executed. On this test server, it's been 4 days since the configuration was installed. I also tried restarting systemctl restart proxmox-backup, but this parameter still doesn't work after 24 hours. There have been several rotations already, but the parameter still hasn't worked out.

1736872498866.png
 
Had a quick glance at the code, what is done here is a bit more subtle than expected. The provided cutoff time only removes the task logs from the archive if they have already exceeded the size limit. Otherwise they are kept. So setting this to one day will only remove the task logs, once the size limit is exceeded as well.

Are you running out of disk space or what is your motivation to limit the task logs?
 
Oh, so the logs will be there until /var/log/proxmox-backup/tasks/archive is filled to 512K?

Are you running out of disk space or what is your motivation to limit the task logs?
Yes, task logs can occupy a significant amount of disk space, and limiting their size is necessary to prevent the disk from becoming completely full.
 
Well, the current implementation only clears out rotated archive files which are older than the one containing the last task within the cutoff time. And the task logs are only cleared if older than the oldest still present entry in the task log archive.

I suspect that this was implemented like this, as the task log archive grows by adding new entries to the bottom. Which makes it hard to remove (older) entries from the top...

How big is your logs though?
 
So until the 'archive' file reaches the limit and is not rotated, the tasks will still exist? What is the exact limit for its rotation?

How big is your logs though?
There are different sizes, but already task files occupy more than 1Gb
Code:
~# du -sch /var/log/proxmox-backup/tasks/* | egrep 'M|G'
744M    /var/log/proxmox-backup/tasks/22
340M    /var/log/proxmox-backup/tasks/5C
415M    /var/log/proxmox-backup/tasks/5D
161M    /var/log/proxmox-backup/tasks/7C
1.7G    total
Code:
~# cat /var/log/proxmox-backup/tasks/archive | wc -l
2264

~# du -sh /var/log/proxmox-backup/tasks/archive
224K    /var/log/proxmox-backup/tasks/archive
 
Last edited: