Skip to content

Instantly share code, notes, and snippets.

@JohnLBevan
Created August 27, 2018 18:53
Show Gist options
  • Select an option

  • Save JohnLBevan/d9338562b0d98aae30b03f954ab49bc7 to your computer and use it in GitHub Desktop.

Select an option

Save JohnLBevan/d9338562b0d98aae30b03f954ab49bc7 to your computer and use it in GitHub Desktop.
FileZilla Log Parser
[pscustomobject[]]$data = Get-Content 'C:\Program Files (x86)\FileZilla Server\Logs\fzs-2018-08-20.log' |
?{$_ -match '^\((?<session>\d+)\)\s(?<datetime>\d\d\/\d\d\/\d{4} \d\d:\d\d:\d\d) - (?<user>.+?) \((?<ip>\d+\.\d+\.\d+\.\d+)\)>\s(?<message>.*)$'} |
%{[pscustomobject]@{
Session = $matches.Session
Ip = $matches.Ip
Server = [System.Net.Dns]::Resolve($matches.Ip).HostName
User = $matches.User
DateTime = [DateTime]::ParseExact($matches.DateTime,'dd/MM/yyyy HH:mm:ss',$null)
Message = $matches.Message
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment