VMware Cloud Community
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Extracting ESXi log using powershell

Hi All,

I'd like to know if it is possible to get or pull the ESXi host information using PowerCLI 4.0 for ESXi 4.0 ?

eg. to get the ESXi log about RAID hard disk failure ? rather than having to ssh UNSUPPORTED to the The VMkernel, vmkwarning, and hostd logs at /var/log/messages

like in: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=102180...

Kind Regards,

AWT

/* Please feel free to provide any comments or input you may have. */
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Dave_Mishchenko
Immortal
Immortal
Jump to solution

The commands do work with ESXi. You can configure ESXi to send logs to a syslog receiver under advanced settings. ESXi can also copy the log files to a datastore locations.

With the vMA the vi-logger component is configured to pull log file from ESXi (and vCenter as well).




Dave

VMware Communities User Moderator

Now available - vSphere Quick Start Guide

Do you have a system or PCI card working with VMDirectPath? Submit your specs to the Unofficial VMDirectPath HCL.

View solution in original post

0 Kudos
7 Replies
Dave_Mishchenko
Immortal
Immortal
Jump to solution

You can use Get-Log. You can also pipe to Select-String to filter the output.

Get-Log messages | select -ExpandProperty Entries

Get-Log hostd | select -ExpandProperty Entries

Get-Log vpxa | select -ExpandProperty Entries






Dave

VMware Communities User Moderator

Now available - vSphere Quick Start Guide

Do you have a system or PCI card working with VMDirectPath? Submit your specs to the Unofficial VMDirectPath HCL.

0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Thanks for the reply Dave,

here's what I've got:

Connect-VIServer -Server 'vCenter'

Get-Log messages | select -ExpandProperty Entries

Get-Log hostd | select -ExpandProperty Entries

Get-Log vpxa | select -ExpandProperty Entries

it stopped with Error:

7/09/2010 7:07:26 PM Get-Log 4651586F-4369-43DE-B54E-50F9ACEAC997 Log with key 'messages' not found.

At :line:3 char:7

+ Get-Log <<<< messages | select -ExpandProperty Entries

7/09/2010 7:07:26 PM Get-Log 4651586F-4369-43DE-B54E-50F9ACEAC997 Log with key 'hostd' not found.

At :line:4 char:7

+ Get-Log <<<< hostd | select -ExpandProperty Entries

7/09/2010 7:07:27 PM Get-Log 4651586F-4369-43DE-B54E-50F9ACEAC997 Log with key 'vpxa' not found.

At :line:5 char:7

+ Get-Log <<<< vpxa | select -ExpandProperty Entries

is itbecause i'm using ESXi 4.0

Kind Regards,

AWT

/* Please feel free to provide any comments or input you may have. */
0 Kudos
LucD
Leadership
Leadership
Jump to solution

To get the ESX logs you have to connect to the ESX server instead of the vCenter.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

AlbertWT
Virtuoso
Virtuoso
Jump to solution

thanks Luc, is this script work for the ESXi ? as i don't have ESX installed on my production environment.

/* Please feel free to provide any comments or input you may have. */
0 Kudos
admin
Immortal
Immortal
Jump to solution

It should work for ESXi as well.

You might want to consider configuring your ESXi boxes to a log to a central syslog server. If you want something supported by VMware, you might want to consider the vMA appliance.

Thanks,

Sia

AlbertWT
Virtuoso
Virtuoso
Jump to solution

ok, thanks foryour reply

to log the entry to syslog can ESXi do that ?

and regarding the vMA, does it pulls all of the log or it does act as the syslog for all of our ESXi server ?

/* Please feel free to provide any comments or input you may have. */
0 Kudos
Dave_Mishchenko
Immortal
Immortal
Jump to solution

The commands do work with ESXi. You can configure ESXi to send logs to a syslog receiver under advanced settings. ESXi can also copy the log files to a datastore locations.

With the vMA the vi-logger component is configured to pull log file from ESXi (and vCenter as well).




Dave

VMware Communities User Moderator

Now available - vSphere Quick Start Guide

Do you have a system or PCI card working with VMDirectPath? Submit your specs to the Unofficial VMDirectPath HCL.

0 Kudos