samedi 2 décembre 2017

Powershell log parsing First Through Last

I am working on a project to parse log files with powershell for my companies software and I am running into a bit of a snag.

I am trying to use powershell to grab the First Through Last session ID in a log set, save to an array then search for another -pattern in the array and output to file or window.

I am able to search for First and Last of a session ID along with context before and after but that doesn't grab all content from First Through Last. Each session can vary so setting a line number would be to hard to guess.

I am reasonably new to scripting and would love to get some input on how I could go about doing this.

So far I have:

select-string -path "C:\ProgramData\application\log.txt" -Pattern "91FBC521-8656-42C8-BFE9-DDDF6893E8AE" -Context 100

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire