I'm currently working on a PowerShell script to analyse VPN traffic by reading the event log of our VPN server.
I'm using WMI to retrieve the relevant event entries and a regular expression to extract information like user name, traffic etc. The event message obviously does contain line breaks which I don't seem to be able to match via my expression.
Example:
The user MYDOMAIN\CHARLY connected on port VPN3-18 on 04.07.2009 at 23:19 and disconnected on 05.07.2009 at 00:03. The user was active for 43 minutes 55 seconds. 886949 bytes were sent and 195113 bytes were received. The reason for disconnecting was user request.
This is my expression:
The user (?<user>\w*\\\w*) connected on port (?<port>\w*-\w*) on (?<connectdate>\w*.\w*.\w*) at (?<connecttime>\w*:\w*) and disconnected on'n(?<disconnectdate>\w*.\w*.\w*) at (?<disconnecttime>\w*:\w*). The user was active for (?<activeminutes>\w*) minutes (?<activeseconds>\w*) seconds. (?<bytessent>\w*) bytes'nwere sent and (?<bytesreceived>\w*) bytes were received. The'nreason for disconnecting was user request.
Right now I don't know what else to try so any help is highly appreciated.