Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
Hello Graham Freckleton
There are two ways to get real IIS logs without storage keys
Before writing a custom logger, note that the three fields you call out (sc-bytes, cs-bytes, time-taken) are measured in HTTP.sys, below the managed pipeline an in-process logger can only approximate them. Two platform options give you the true values with no access keys:
- Diagnostic settings → Log Analytics (recommended). App Service Diagnostic settings (Azure Monitor, not "App Service logs") has an HTTP logs category that lands in the
AppServiceHTTPLogstable. It contains the genuine IIS values:ScBytes,CsBytes,TimeTaken,ScStatus,ScSubStatus,ScWin32Status,CsUriStem,CsUriQuery,CsUsername,UserAgent,Referer,Cookie,CIp,SPort,ComputerName. Sending to Log Analytics or Event Hubs involves no storage keys at all. (Caveat: the storage account destination of diagnostic settings still writes with account keys internally, so it breaks on shared-key-disabled accounts just like the built-in blob logging see this Q&A.) - Keep "Web server logging = File System" (needs no storage account; quota-limited, rotating) and ship
D:\home\LogFiles\http\RawLogs\*.logto blob yourself with a scheduled WebJob usingAzure.Storage.Blobs+DefaultAzureCredential. True IIS logs, MI-authenticated shipping, no custom request instrumentation.
There is no official Microsoft sample that reproduces the complete W3C line (with sc-bytes/cs-bytes/time-taken) from inside a Framework app because those three values are produced by HTTP.sys below the managed pipeline.
W3CLogger in ASP.NET Core a modern ASP.NET Core has this exact feature built in (W3C-format request logging middleware), plus metaljase/HttpLoggingW3CLoggingSerilogExamples with runnable examples.