I've got a small string to look at a log file for any instances of the word Error
and also added a count of how many time this occurs in said log file.
( Get-Content "C:\Users\mchalmer\Desktop\ControlOIS.log" | Where-Object { $_.Contains("ERROR") } ).Count
I would like to know if it's possible to get the string of text after the Error
word was detected?
Here is a small snipped of the Log file for context:
2017-10-01 05:37:51:109 - ERROR: [Service App] Unable to start worker process, Error performing "LogonUser", error code: 87. "The parameter is incorrect"
What I would like to do is set up a way to grab all errors with the relevant string from the log file and dump out in a file for me so I can quickly see what needs to be fixed.