How to Locate and Read IIS Request Logs
IIS logging is configured per site, and the directory can be changed. The historical C:\WINNT\System32\LogFiles\W3SVC1 path is not a reliable locator for a current server.
Find the site and configured directory
Open IIS Manager, select the site and open Logging. Record the format and directory. The common W3C default is %SystemDrive%\inetpub\logs\LogFiles, with one W3SVC<site-id> directory per site.
This read-only Windows PowerShell example lists the site identities:
$appcmd = Join-Path $env:windir 'System32\inetsrv\appcmd.exe'
& $appcmd list site
After confirming the actual directory and site ID, read the newest log:
$logDirectory = 'C:\inetpub\logs\LogFiles\W3SVC1'
$latest = Get-ChildItem -LiteralPath $logDirectory -Filter '*.log' -File |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
if ($null -eq $latest) { throw 'No log file exists at the selected path.' }
Get-Content -LiteralPath $latest.FullName -Tail 80
Interpret the fields that were actually recorded
Read the file's #Fields: header before interpreting a row. Field order is configurable. For troubleshooting, useful fields include cs-uri-stem, sc-status, sc-substatus, sc-win32-status and time-taken.
A row whose selected status fields are 404 0 2 is a starting point for a missing-resource investigation. The same browser-level 404 can have a different substatus and cause. Correlate the exact URL and time rather than searching for any failure in the file. W3C timestamps use UTC, so convert the user's local incident time before comparing it.
If the request is absent
Logging can be disabled, buffered or directed elsewhere. A request can also fail before the selected IIS site handles it. Check HTTP.sys error logs, the reverse proxy and the site binding as appropriate. An empty tail does not prove the request never reached the machine. Keep log extracts limited to the relevant request because URLs and query strings may contain sensitive data.
References


Author: Herman Schoenfeld