VMware Cloud Community
Pilu1978
Enthusiast
Enthusiast
Jump to solution

Time Stamp of a Log Entry

Hi,

The Esxi 6.5 hosts in our environment are hit by the issue as mentioned in the below KB article.

Host goes to non-responsive state - "IPMI SEL unavailable" (70973) (vmware.com)

I have written the below script to find out the impacted hosts, if any:

$esxlist = Get-VMHost | where {$_.version -eq "6.5.0"}
Foreach ($esxhost in $esxlist){
Write-Host "Please wait.....checking logs on $($esxhost.name)" -ForegroundColor Green
(get-log -vmhost $esxhost -key vmkernel).Entries | Where-object -FilterScript {$_ -match "IPMI SEL unavailable*"}

}

However it is return the entries like below:

2019-06-11T03:43:13.066Z error hostd[11403B70] [Originator@6876 sub=Cimsvc] IPMI SEL unavailable

Is there any easy way to capture only time stamp (2019-06-11T03:43:13.066Z) of that entry.

Please help.

 

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could do something like this

$text = '2019-06-11T03:43:13.066Z error hostd[11403B70] [Originator@6876 sub=Cimsvc] IPMI SEL unavailable'

[datetime]($text.Split(' ')[0])

In your script that could be something like this

$text = '2019-06-11T03:43:13.066Z error hostd[11403B70] [Originator@6876 sub=Cimsvc] IPMI SEL unavailable'

[datetime]($text.Split(' ')[0])

$esxlist = Get-VMHost | where {$_.version -eq "6.5.0"}
Foreach ($esxhost in $esxlist){
    Write-Host "Please wait.....checking logs on $($esxhost.name)" -ForegroundColor Green
    (Get-Log -VMHost $esxhost -Key vmkernel).Entries | 
    Where-object -FilterScript {$_ -match "IPMI SEL unavailable*"} |
    Select @{N='TimeStamp';E={[DateTime]($_.Split(' ')[0])}}

}


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You could do something like this

$text = '2019-06-11T03:43:13.066Z error hostd[11403B70] [Originator@6876 sub=Cimsvc] IPMI SEL unavailable'

[datetime]($text.Split(' ')[0])

In your script that could be something like this

$text = '2019-06-11T03:43:13.066Z error hostd[11403B70] [Originator@6876 sub=Cimsvc] IPMI SEL unavailable'

[datetime]($text.Split(' ')[0])

$esxlist = Get-VMHost | where {$_.version -eq "6.5.0"}
Foreach ($esxhost in $esxlist){
    Write-Host "Please wait.....checking logs on $($esxhost.name)" -ForegroundColor Green
    (Get-Log -VMHost $esxhost -Key vmkernel).Entries | 
    Where-object -FilterScript {$_ -match "IPMI SEL unavailable*"} |
    Select @{N='TimeStamp';E={[DateTime]($_.Split(' ')[0])}}

}


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

Reply
0 Kudos
Pilu1978
Enthusiast
Enthusiast
Jump to solution

Aah perfect. Thanks a lot.

Reply
0 Kudos