VMware Cloud Community
JerryH
Contributor
Contributor

Get-Log - older logs?

Hi, been playing a little with Get-Log which is a nice feature.

However, it seems that it only gives you the current logs, not for instance vmkernel.1,2,3 etc?

Am i missing something or is this on purpose?

Our ESX servers are "loud" in the vmkernel logs so the current log is cycled pretty fast.

Any thoughts on this?

/J

0 Kudos
5 Replies
ykalchev
VMware Employee
VMware Employee

Hi Jerry,

Specifying Key parameter you can browse all available VC or ESX hosts logs.

VMKerner log is an ESX host log so you should pass VMHost parameter especially if you're currently connected to VC.

$esx = Get-VMHost <myhost>
Get-Log -Key "vmkernel", "vmksummary", "vmkwarning" -VMhost $esx 

To query available logs on your server, try this code:

$esx = Get-VMHost <myhost>
$esxView = Get-View $esx.Id
$si = Get-View ServiceInstance-ServiceInstance
$diagM = Get-View $si.Content.DiagnosticManager
$diagM.QueryDescriptions($esxView.MoRef)

So if an older logs are available you should see keys like vmkernel:vmkernel-2.log.

BTW you can filter vmkernel keys only using

$diagM.QueryDescriptions($esxView.MoRef) | where {$_.key.startswith("vmkernel")}

Regards,

Yasen

Yasen Kalchev, vSM Dev Team
0 Kudos
LucD
Leadership
Leadership

Yasen, are you sure that the "old" logs appear with the QueryDescriptions method ?

When I do this I only get pointers to the current logs not the old ones.

The keys I get are "hostd", "messages", "vmkernel" ... not for example vmkernel:vmkernel-2.log like you indicated.

And when I retrieve the logs I only get the lines from the current log not the old ones.

$logdesc = $diagM.QueryDescriptions($esxView.MoRef)

$log = $diagM.BrowseDiagnosticLog($esxView.MoRef, $logdesc[<log-index>].Key, $null, $null)


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

0 Kudos
JerryH
Contributor
Contributor

Hi, I might have been unclear, i have no problems getting the current logs, vmkernel,hostd etc.

What i'm looking for is a way to reach the older logs with the same command.

When i use Get-Logtype on the host it only seems to expose the current ones?

Get-Logtype :

hostd server log in 'plain' format

messages server log in 'plain' format

vmkernel server log in 'plain' format

vmksummary server log in 'plain' format

vmkwarning server log in 'plain' format

vpxa VirtualCenter agent log in 'plain' format

So, do they need to do a rewrite stuff to enable this or am i missing some parameters to access those older logs?

/Jerry

0 Kudos
LucD
Leadership
Leadership

Exactly my point, I can't see the "old" logs like Yasen stated.

Since the SDK method only seems to return the "current" logs (and not the "old" ones) I'm afraid there is something missing at a lower level than the VI Toolkit.


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

0 Kudos
ykalchev
VMware Employee
VMware Employee

Well it seems I was misled by vpxd log where you can browse older logs in the way I describe in my previous post.

PS D:\&gt; Get-LogType

Key Summary

vpxd:vpxd-0.log VirtualCenter server log in 'plain' format

vpxd:vpxd-1.log VirtualCenter server log in 'plain' format

vpxd:vpxd-2.log VirtualCenter server log in 'plain' format

vpxd:vpxd-3.log VirtualCenter server log in 'plain' format

vpxd:vpxd-4.log VirtualCenter server log in 'plain' format

vpxd:vpxd-5.log VirtualCenter server log in 'plain' format

vpxd:vpxd-6.log VirtualCenter server log in 'plain' format

vpxd:vpxd-7.log VirtualCenter server log in 'plain' format

vpxd:vpxd-8.log VirtualCenter server log in 'plain' format

vpxd:vpxd-9.log VirtualCenter server log in 'plain' format

vpxd:vpxd-index VirtualCenter server log in 'plain' format

Apparently vmkernel logs do not support such fuctionality because if you browse VI Client logs for the host you get same result as Get-LogType cmdlet.

Sorry if i mislead you also.

/Yasen

Yasen Kalchev, vSM Dev Team
0 Kudos