Working with the ESXi Support Bundle – A New way to Review logs from ESXi Support Bundle (Part 3)

Please note that this is Part 3 of the “Working with ESXi Support Bundle”. I will recommend you review the below Links to have an understanding of the concept.

Working with the ESXi Support Bundle – Basic Understanding of Workflow (Part 1)

Working with the ESXi Support Bundle – Ways to Capture the ESXi Support Bundle (Part 2)

Now here we are going to learn one of the ways with which we can simplify the process of log review. The biggest challenge that people who are working on Windows OS face is that extracting the ESXi Support bundle along with the Zipped log file takes a lot of time in extraction.

Even after you have extracted the support bundle, there are a lot of files that are compressed to keep the size in check. For example:

In order to find a solution I have created a BAT Script which you can run on windows and will help you to do all the tasks for you.

Pre-requisite:

  1. You should have 7z installed on the System at the location: “C:\Program Files\7-Zip\7z.exe”.
  2. You should have required permissions to run a Bat script on your system.
  3. You can download the script from: File Merge Script 3.0

 

Procedure:

  1. Download the support bundle/bundles in a separate directory. For example C:\Test\Working with the ESXi Support Bundle - A New way to Review logs from ESXi Support Bundle
  2. Paste the script attached in the Article to the same location:Working with the ESXi Support Bundle - A New way to Review logs from ESXi Support Bundle
  3. Execute the script by double clicking on the BAT File.

Working with the ESXi Support Bundle - A New way to Review logs from ESXi Support Bundle

The Script will do the following task for you:

  • Extracting the TGZ File from the Zip File.
  • Extracting the Tar File from the TGZ File
  • Extracting the Support bundle Folder from the Tar File.
  • Execute the Commands inside these folders which will further extract all the GZ Files
  • Combine the Most common log files and will save it on the Root of the Support Bundle Folder.

Script Details:

cls
@ECHO OFF
ECHO. ***********************************
ECHO. ** Extraction Commands **
ECHO. ***********************************

"C:\Program Files\7-Zip\7z.exe" x "%cd%\*.zip" -o"%cd%\"
"C:\Program Files\7-Zip\7z.exe" x "%cd%\*.tgz" -o"%cd%\"
"C:\Program Files\7-Zip\7z.exe" x "%cd%\*.tar" -o"%cd%\"
"C:\Program Files\7-Zip\7z.exe" x "%cd%\*.gz" -o"%cd%\"
"C:\Program Files\7-Zip\7z.exe" x "%cd%\vc-*.tgz" -o"%cd%\"
"C:\Program Files\7-Zip\7z.exe" x "%cd%\esx-*.tgz" -o"%cd%\"

for /D %%a in ("%cd%\*.*") do (

ECHO. ***********************************
ECHO. ** VMKernel **
ECHO. ***********************************

"C:\Program Files\7-Zip\7z.exe" x "%%a\var\run\log\vmkernel*.gz" -o"%%a\var\run\log\"
del "%%a\var\run\log\vmkernel*.gz"
ren "%%a\var\run\log\vmkernel.log" "vmkernel"
type "%%a\var\run\log\vmkernel.*" >> "%%a\vmkernel_combined.log"
ren "%%a\var\run\log\vmkernel" "vmkernel.log"

ECHO. ***********************************
ECHO. ** HOSTD **
ECHO. ***********************************

"C:\Program Files\7-Zip\7z.exe" x "%%a\var\run\log\hostd*.gz" -o"%%a\var\run\log\"
del "%%a\var\run\log\hostd*.gz"
ren "%%a\var\run\log\hostd.log" "hostd"
type "%%a\var\run\log\hostd.*" >> "%%a\hostd_combined.log"
ren "%%a\var\run\log\hostd" "hostd.log"

ECHO. ***********************************
ECHO. ** vobd **
ECHO. ***********************************

"C:\Program Files\7-Zip\7z.exe" x "%%a\var\run\log\vobd*.gz" -o"%%a\var\run\log\"
del "%%a\var\run\log\vobd*.gz"
ren "%%a\var\run\log\vobd.log" "vobd"
type "%%a\var\run\log\vobd.*" >> "%%a\vobd_combined.log"
ren "%%a\var\run\log\vobd" "vobd.log"

ECHO. ***********************************
ECHO. ** VPXA **
ECHO. ***********************************

"C:\Program Files\7-Zip\7z.exe" x "%%a\var\run\log\vpxa*.gz" -o"%%a\var\run\log\"
del "%%a\var\run\log\vpxa*.gz"
ren "%%a\var\run\log\vpxa.log" "vpxa"
type "%%a\var\run\log\vpxa.*" >> "%%a\vpxa_combined.log"
ren "%%a\var\run\log\vpxa" "vpxa.log"

ECHO. ***********************************
ECHO. ** FDM **
ECHO. ***********************************

"C:\Program Files\7-Zip\7z.exe" x "%%a\var\run\log\fdm*.gz" -o"%%a\var\run\log\"
del "%%a\var\run\log\fdm*.gz"
ren "%%a\var\run\log\fdm.log" "fdm"
type "%%a\var\run\log\fdm.*" >> "%%a\fdm_combined.log"
ren "%%a\var\run\log\fdm" "fdm.log"
)

FOR %%F IN (*.*) DO (
IF %%~zF LSS 1 DEL %%F)

cmd /k
cls
EXIT

Ashutosh Dixit

I am currently working as a Senior Technical Support Engineer with VMware Premier Services for Telco. Before this, I worked as a Technical Lead with Microsoft Enterprise Platform Support for Production and Premier Support. I am an expert in High-Availability, Deployments, and VMware Core technology along with Tanzu and Horizon.

This Post Has One Comment

  1. Svajjen

    Thanks! This was exactly what I was looking for. I’m importing log bundles into Log Insight for analysis and needed to unpack the gz files after unpacking the entire thing.

Leave a Reply