Advertisement
guyrleech

Parse VMware Horizon Client log

Apr 5th, 2024 (edited)
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 0.92 KB | Software | 0 0
  1. ## Parse the log lines from today's VMware Horizon client side or Connection Server log file using regex groups so can be filtered, sorted, etc
  2.  
  3. ## 2024-04-05T09:59:01.920+01:00 INFO  (66E8-4C8C) <vmware-usbd> [vmware-view-usbdloader] mmfw_PipeRead: called (client @ 15C471019A0)
  4.  
  5. Get-Content -Path "$env:programdata\VMware\VDM\logs\log-$([datetime]::Now.ToString('yyyy-MM-dd')).txt" |select @{n='Date';e={ if( $_ -match '^(?<date>[\S+]+)\s+(?<level>\w+)\s+\((?<hex>[0-9a-f]+-[0-9a-f]+)\)\s+<(?<Subcomponent>\S+)>\s+\[(?<Component>\S+)\]\s+(?<message>.*)$' ) { $matches[ 'date' ] -as [datetimeoffset] | Select -expand LocalDateTime ; $script:tokens = $matches.Clone() } else { Write-Warning -Message "Cannot parse $_" ;  $script:tokens = @{} } }},@{n='Level';e={$script:tokens['level']}},@{n='Component';e={$script:tokens[ 'component' ]}},@{n='SubComponent';e={$script:tokens[ 'subcomponent' ]}},@{n='Message';e={$script:tokens['message']}}
  6.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement