Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Powershell to access IIS logs? [closed]

I know you can use PowerShell to make things like the registry a drive letter. There are other objects in PowerShell to treat other objects in this way. Does anyone know of any cmdlets to access IIS logs in this manner?

like image 341
MikeJ Avatar asked Nov 14 '22 17:11

MikeJ


1 Answers

Would a quick and dirty script work? The third line of the W3c log file header (saved by default by IIS) has a #Header line... Save the following as Import-W3CLog.ps1

param ($logfile)
import-csv -Delimiter " " -Header "date","time","s-ip","cs-method","cs-uri-stem","cs-uri-query","s-port","cs-username","c-ip","csUser-Agent","sc-status","sc-substatus","sc-win32-status","time-taken" -path $logfile | where { !($_.Date.StartsWith('#')) }
like image 132
Erich Stehr Avatar answered Dec 20 '22 04:12

Erich Stehr