View Active VirtualCenter 2.0.x Log File

I was looking for a way to view the current VirtualCenter log file, and since VC uses a rotating log system I couldn’t simply have a shortcut on my desktop to go to the log.
VC does a simple 0 to 9 log file (vpxd-0.log to vpxd-9.log) rotation using an index file (vpxd-index) to record the which file is the current file.
Two things initiate a rotation of the logs. One is the starting, or restarting, of the VMware VirtualCenter Server service. The other is when the log file reaches 5MB.
So with the help of some search engines results, I cobbled together the following batch file to get the active log file and then tail it.
[cmd]
@echo off
echo.
echo Tailing the current VirtualCenter log file
echo.

SET LogDir=C:\Documents and Settings\<strong>user_account</strong>\Local Settings\Temp\vpx\

REM Get the current log file number being used
SET /p LogNum=&lt;"%LogDir%vpxd-index"

echo Starting the tailing process
START "Tailing VirualCenter Log vpxd-%LogNum%.log (Ctrl + C to Close)" /D "%LogDir%" tail -f "%LogDir%vpxd-%LogNum%.log"
[/cmd]

A quick note to replace user_account with the correct directory. In my environment this is an Active Directory service account especially set up to run VirtualCenter. I shall need to check, however, from memory I if the service is still being run as Local System, which is the default on installation, then the log files are located in C:\Windows\Temp\vpx\.

I know a batch file not the most up to date in scripting technology but it works and does I what I need it to do.

One thing this script does not do, is detect when the log file is rotated whilst being tailed. Something for a future version, maybe.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.