Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## 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
- ## 2024-04-05T09:59:01.920+01:00 INFO (66E8-4C8C) <vmware-usbd> [vmware-view-usbdloader] mmfw_PipeRead: called (client @ 15C471019A0)
- 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']}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement