vmCalgary
Enthusiast
Enthusiast


@LucD wrote:

I'm not sure why you split each line on a vertical bar, in the example lines I don't see any


I wasn't sure what that line was doing in the original code.

VMware.log looks like this, as you well know.

2021-11-04T17:16:28.362Z| vmx| I125: Vix: [956803 mainDispatch.c:4253]: VMAutomation: Ignoring ReportPowerOpFinished because the VMX is shutting down.
2021-11-04T17:16:28.362Z| vmx| I125: Transitioned vmx/execState/val to poweredOff
2021-11-04T17:16:28.362Z| vmx| I125: Vigor_ClientRequestCb: failed to do op=5 on unregistered device 'ConfigParams' (cmd=(null))
2021-11-04T17:16:28.362Z| vmx| I125: VMX idle exit
2021-11-04T17:16:28.378Z| vmx| I125: Vix: [956803 mainDispatch.c:834]: VMAutomation_LateShutdown()
2021-11-04T17:16:28.378Z| vmx| I125: Vix: [956803 mainDispatch.c:783]: VMAutomationCloseListenerSocket. Closing listener socket.
2021-11-04T17:16:28.380Z| vmx| I125: Flushing VMX VMDB connections
2021-11-04T17:16:28.380Z| vmx| I125: VigorTransport_ServerCloseClient: Closing transport 1CB4529850 (err = 0)
2021-11-04T17:16:28.380Z| vmx| I125: VigorTransport_ServerDestroy: server destroyed.
2021-11-04T17:16:28.380Z| vmx| I125: VMX exit (0).
2021-11-04T17:16:28.381Z| vmx| I125: AIOMGR-S : stat o=153 r=308 w=59 i=125 br=4458660 bw=338807
2021-11-04T17:16:28.381Z| vmx| I125: AIOMGR-U : stat o=14 r=12 w=127 i=0 br=96 bw=214512
2021-11-04T17:16:28.381Z| vmx| I125: OBJLIB-LIB: ObjLib cleanup done.
2021-11-04T17:16:28.381Z| vmx| W115: VMX has left the building: 0.

 I'll focus on what I want to get from the log. I want timestamp and the message.

Timestamp

VMX has left the building: 0.

Transitioned vmx/execState/val to poweredOff

VMX exit (0).

Is this how I'd write my regex?

 Get-Content -Path $tempFile | where {$_ -match 'VMX has left the building'|'CPU reset:'|'power|'Power'|'vmotion'|'Vmotion' } |

Reply
0 Kudos