Overview of the logdiskcheck.sh automated log cleanup utility in vCenter Server
search cancel

Overview of the logdiskcheck.sh automated log cleanup utility in vCenter Server

book

Article ID: 429812

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

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.

 

Environment

VMware vCenter Server

Cause

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

Resolution

The script logic performs the following checks and actions:

  1. Check: Verifies if the disk usage of /var/log/vmware/ is 90% or higher.

  2. 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.

Additional Information

vCenter Server における logdiskcheck.sh 自動ログクリーンアップユーティリティの概要