This article describes the automated mechanism configured to prevent the /var/log partition from filling up on vCenter Server.
A utility script named logdiskcheck.sh is executed via cron to monitor disk usage and perform cleanup if a critical threshold is reached.
VMware vCenter Server
The script is scheduled to run every 10 minutes via the following cron job:
/etc/cron.d/logdiskcheck.cron
*/10 * * * * root /usr/sbin/logdiskcheck.sh >/dev/null 2>&1
The script logic performs the following checks and actions:
Check: Verifies if the disk usage of /var/log/vmware/ is 90% or higher.
Action (if threshold is reach):
Logs a warning: WARN logdisk nearly full. Attempt to cleanup.
Force Rotate: Executes logrotate -f /etc/logrotate.conf to immediately rotate all logs.
Delete Dump Files: Deletes .hprof (Java heap dump) files older than 7 days.