Configure IIS Logging

I always move my IIS logs to a different drive, and I almost always include all fields.  This is something that annoys me since I have to do it over and over again.  Just like everything that I have to do over and over again, I wrote a script to do it for me.

The below script is used with the SolarWinds NetPerfMon website, but it can easily be tweaked for any website on a server.

$AllIisLogFields = "Date,Time,ClientIP,UserName,SiteName,ComputerName,ServerIP,Method,UriStem,UriQuery,HttpStatus,Win32Status,BytesSent,BytesRecv,TimeTaken,ServerPort,UserAgent,Cookie,Referer,ProtocolVersion,Host,HttpSubStatus"
Set-ItemProperty "IIS:\Sites\SolarWinds NetPerfMon" -name logFile -value @{ period = "Hourly" }
Set-ItemProperty "IIS:\Sites\SolarWinds NetPerfMon" -name logFile -value @{ logExtFileFlags = $AllIisLogFields }

 

DISCLAIMER: These materials are provided “AS IS” without any express or implied warranty of any kind.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.