Use this when reading or configuring IIS request logs.
Logging
IIS logging writes one line per request with time, client IP, URL, status, substatus and time-taken to C:\inetpub\logs\LogFiles, in W3C format by default. HTTP.sys errors are logged separately in HTTPERR.
1. Log location per site.
2. Fields include sc-status, sc-substatus, sc-win32-status, time-taken.
3. HTTPERR log for HTTP.sys rejections.
4. Rollover and retention.
5. Ship to central logging.
each request logged with status and timing
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
# Where does a site log, and which fields?
$site = Get-IISSite -Name 'intranet'
$site.LogFile | Select-Object Directory, LogFormat, Period, LogExtFileFlags
# Last lines of today's log for site ID 2
Get-ChildItem C:\inetpub\logs\LogFiles\W3SVC2 | Sort-Object LastWriteTime | Select-Object -Last 1 | Get-Content -Tail 20
# Count status codes in a log file
Get-Content C:\inetpub\logs\LogFiles\W3SVC2\u_ex261129.log | Where-Object { $_ -notmatch '^#' } |
ForEach-Object { ($_ -split ' ')[11] } | Group-Object | Sort-Object Count -Descending
The column index depends on the #Fields: header line of the file — read it before parsing. Log Parser or a log platform (Elastic, Splunk, Azure Monitor) is easier for large volumes.
Step 2 Troubleshooting Narrow the fault
- No log files: logging disabled for the site, wrong directory permissions, or the request never reached IIS.
- Disk full: logs never cleaned up — move to a data volume and add retention.
- Need more detail for one error: enable Failed Request Tracing for that status code and URL, reproduce, then disable it.
Step 3 Common mistakes Narrow the fault
- Logs on C: without rotation or cleanup.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- W3C fields are configurable per site.
- time-taken shows slow requests in milliseconds.
- HTTPERR logs requests rejected before reaching IIS.
Get-Website— sites, state, bindingsGet-IISAppPool— application pools and stateGet-WebBinding— bindingsGet-ChildItem IIS:\SslBindings— certificate bindingsGet-Content C:\inetpub\logs\LogFiles\W3SVC<id>\*.log -Tail 20— request log
ReferenceWhat it is1 section · depth on demand
Direct Answer
IIS logs each completed request per site in W3C format under inetpub\logs\LogFiles\W3SVC<id>, with UTC times, sc-status/sc-substatus, sc-win32-status and time-taken (ms). Behind a load balancer add an X-Forwarded-For custom field. Requests that never reached a site are in HTTPERR; for a deep look at one failing request use Failed Request Tracing.
ReferenceWhy it matters1 section · depth on demand
What it is
IIS writes one log per site per day in W3C format by default, after each request completes. sc-status, sc-substatus and sc-win32-status together explain errors (for example 401.2 = no allowed authentication method). time-taken is in milliseconds and includes sending the response.
ReferenceImportant terms & boundaries2 sections · depth on demand
Settings
Get-WebConfigurationProperty -Filter system.applicationHost/sites/siteDefaults/logFile -Name directory
W3C format fields: date, time, s-ip, cs-method, cs-uri-stem, sc-status, time-taken. Add X-Forwarded-For as a custom field behind proxies.
In depth
IIS writes an access log per site, by default in W3C format, one file per day, to %SystemDrive%\inetpub\logs\LogFiles\W3SVC<siteID>. Entries are written after the request completes, and times are in UTC.
Default W3C fields worth knowing
| Field | Meaning |
|---|---|
date, time | Completion time (UTC) |
s-ip, s-port | Server address and port that received the request |
cs-method, cs-uri-stem, cs-uri-query | Request |
cs-username | Authenticated user (empty for anonymous) |
c-ip | Client IP — the load balancer's IP behind a proxy |
cs(User-Agent), cs(Referer) | Client info |
sc-status, sc-substatus | HTTP status and IIS substatus (e.g. 401.2, 500.19) |
sc-win32-status | Windows error code for the outcome (0 = success; e.g. 64 = client disconnected) |
time-taken | Milliseconds, including time to send the response |
Behind a load balancer
Add a custom field that logs the X-Forwarded-For request header (IIS 8.5 and later), otherwise every request appears to come from the proxy.
Other logs
- HTTPERR (
%SystemRoot%\System32\LogFiles\HTTPERR) — requests rejected by HTTP.sys before reaching a site. - Failed Request Tracing (FREB) — detailed per-request pipeline traces for chosen status codes or durations, in
%SystemDrive%\inetpub\logs\FailedReqLogFiles. - Event logs — WAS and W3SVC events in System; application errors in Application.
- ASP.NET Core stdout logs when enabled in
web.config.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in IIS → Logging. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/iis/ · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Deep reference
Healthy vs suspicious evidence
Output interpretation
| Pattern | Meaning |
|---|---|
| Request missing from the log | It never reached the site — HTTPERR, wrong binding, load balancer, or still in progress |
High time-taken with small responses | Slow application or back end; for large responses it may be a slow client |
sc-win32-status 64 | Client disconnected before the response completed |
| Many 401s followed by 200 | Normal Negotiate/NTLM handshake (401 challenge, then success) |
All c-ip identical | Behind a proxy — log X-Forwarded-For |
| Timestamps off by hours | Log times are UTC |