How Can I Purge Older Log Files From the HVR logarchives Directory?
Question
How can I safely purge old archived logs from the HVR $HVR_CONFIG/logarchives directory to prevent the hub server from running out of disk space?
Environment
- HVR 6
- System: Unix or Linux
Answer
To automate and safely purge old log files from your HVR archive directories:
Decide how many days of logs you want to keep for compliance or troubleshooting. For example, 30 days is a common starting point.
Set up the cron job:
i. Open the hub host's crontab as the
hvrorrootuser:crontab -eii. Add the following cron jobs. Edit the paths and hub name to match your installation:
# Purge hub-specific logarchives older than 30d (runs daily at 03:15) 15 3 * * * find /opt/hvr/hvr_config/hubs/<hub>/logarchives -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \; # Purge Hub-Server-wide logarchives older than 30d (runs daily at 03:20) 20 3 * * * find /opt/hvr/hvr_config/logarchives -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \;-mindepth 1 -maxdepth 1ensures only subdirectories (timestamped log sets) are deleted, never the parentlogarchivesdirectory itself. Adjust+30to match your preferred retention.Confirm the log archive locations. We may store archived logs in the following locations:
$HVR_CONFIG/hubs/<hub>/logarchives/: Channel and job logs for a specific hub.$HVR_CONFIG/logarchives/: Hub-Server-wide logs, shared by all hubs on the host.
Save and exit the crontab. The cron job runs automatically as scheduled.
If you have compliance or auditing requirements, adjust the retention policy accordingly. Always confirm script actions in a test environment before production use.
For more information, see Maintenance and Monitoring.