index.1
anymore, which happens here https://git.proxmox.com/?p=pve-mana...4e01931b2f6b9577c49b0514745ba9eb;hb=HEAD#l129I made a script that changes the number of 20,000 entries (around 1 year task history) by cron.Hi, no there is no option to configure this. The size of the archived tasks is hard coded to about 1000 entries, as you can see here https://git.proxmox.com/?p=pve-comm...6f62250b47c7b4aee163d2adeb847685;hb=HEAD#l354
The tasks are cleaned up once they are not referenced byindex.1
anymore, which happens here https://git.proxmox.com/?p=pve-mana...4e01931b2f6b9577c49b0514745ba9eb;hb=HEAD#l129
#!/bin/bash
# /etc/cronscripts/change_pve_task_history_size/update_pve_max_task_history_size.sh
# Path to the RESTEnvironment.pm file
FILE="/usr/share/perl5/PVE/RESTEnvironment.pm"
# Search and replacement strings
SEARCH="my \$maxsize = 50000; # about 1000 entries"
REPLACE="my \$maxsize = 1000000; # about 20000 entries, around 1 year task history"
# Check if the file exists
if [[ -f "$FILE" ]]; then
# Check if the target string exists in the file
if grep -qF "$SEARCH" "$FILE"; then
logger -t change_pve_task_history_size "String found in $FILE. Replacing '$SEARCH' with '$REPLACE'."
# Create a backup of the file
BACKUP_FILE="$FILE.$(date +%Y%m%d_%H%M%S)"
cp "$FILE" "$BACKUP_FILE"
logger -t change_pve_task_history_size "Backup created: $BACKUP_FILE"
# Replace the target string in the file
sed -i "s|$SEARCH|$REPLACE|" "$FILE"
logger -t change_pve_task_history_size "String replaced successfully in $FILE."
# Restart Proxmox services
systemctl restart pvedaemon.service pveproxy.service
logger -t change_pve_task_history_size "Services restarted."
else
logger -t change_pve_task_history_size "Search string not found in $FILE. No changes made."
fi
else
logger -t change_pve_task_history_size "File $FILE does not exist!"
fi
# Cron job for updating Proxmox task history size
# /etc/cron.d/change_pve_task_history_size
@reboot root /etc/cronscripts/change_pve_task_history_size/update_pve_max_task_history_size.sh
0 * * * * root /etc/cronscripts/change_pve_task_history_size/update_pve_max_task_history_size.sh
/etc/cronscripts/change_pve_task_history_size/update_pve_max_task_history_size.sh
journalctl -t change_pve_task_history_size
Jan 06 12:00:00 hostname change_pve_task_history_size[1234]: String found in /usr/share/perl5/PVE/RESTEnvironment.pm. Replacing 'my $maxsize = 50000; # about 1000 entries' with 'my $maxsize = 1000000; # about 20000 entries, around 1 year task history'.
Jan 06 12:00:00 hostname change_pve_task_history_size[1234]: Backup created: /usr/share/perl5/PVE/RESTEnvironment.pm.20250106_120000
Jan 06 12:00:00 hostname change_pve_task_history_size[1234]: String replaced successfully in /usr/share/perl5/PVE/RESTEnvironment.pm.
Jan 06 12:00:01 hostname change_pve_task_history_size[1234]: Services restarted.
Try it.Hi, is there any way of increasing the length of time that logs are stored in /var/log/pve/tasks? It doesn't look like they are cleanup up by logrotate.
Hi, no there is no option to configure this. The size of the archived tasks is hard coded to about 1000 entries, as you can see here https://git.proxmox.com/?p=pve-comm...6f62250b47c7b4aee163d2adeb847685;hb=HEAD#l354
The tasks are cleaned up once they are not referenced byindex.1
anymore, which happens here https://git.proxmox.com/?p=pve-mana...4e01931b2f6b9577c49b0514745ba9eb;hb=HEAD#l129
We use essential cookies to make this site work, and optional cookies to enhance your experience.