Advertisement
guyrleech

Parsing Squid proxy logs

Nov 13th, 2019
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [datetime]$todayStart = Get-Date -Date ([datetime]::Now) -Hour 0 -Minute 0 -Second 0
  2. [datetime]$date1970=Get-Date -Date '1/1/1970';(Get-Content -Path C:\Squid\var\log\squid\access.log) -replace '\s+',' '|Select-Object -Last 1000|ConvertFrom-Csv -Delimiter ' ' -Header Time,Duration,ClientAddress,Result,Bytes,Method,URL,User,Hierarchy,type|Select-Object -Property @{n='Time';e={$date1970.AddSeconds( $_.Time )}},* -ExcludeProperty Time|Where-Object{ $_.ClientAddress -eq '10.1.1.109' -and $_.Method -eq 'GET' -and $_.Time -gt $todayStart }|Out-GridView
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement