PtiTom

IIS Log File extraction

Mar 20th, 2015
293
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $MaxDelay = 5000
  2. $TimeoutDelay = 30000
  3.  
  4. $IISLogPath = "FullLogPath"
  5. $IISLogFileRaw = [System.IO.File]::ReadAllLines($IISLogPath)
  6. $headers = $IISLogFileRaw[3].split(" ".ToCharArray(), [System.StringSplitOptions]::RemoveEmptyEntries)
  7. $headers = $headers | where {$_ -ne "#Fields:"}
  8. $IISLogFileCSV = Import-Csv -Delimiter " " -Header $headers -Path $IISLogPath
  9. $IISLogFileCSV = $IISLogFileCSV | where {$_.date -notlike "#*"}
  10. $timeTaken = $IISLogFileCSV | foreach {$_.$("time-taken")}
  11. $IISLogFileCSV | where {[int]$_.$("time-taken") -gt $MaxDelay} | Format-Table -AutoSize time, cs-username, cs-uri-stem, time-taken, sc-bytes
  12. $IISLogFileCSV | where {[int]$_.$("time-taken") -gt $TimeoutDelay} | Format-Table -AutoSize time, cs-username, cs-uri-stem, time-taken, sc-bytes
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×