To enable IIS logging on Azure App Service, 1. Enter the App Service resources, 2. Find the "App Service logs" menu, 3. Select "File System" or "Blob Storage" in the "IIS logs" section. It is recommended to select Blob Storage when retention for a long time; IIS logs record client IP, user agent, request method, URL, status code, processing time, data volume and other information by default; viewing methods include Kudu console, downloading blobs or using the portal Log Stream tool, among which Blob storage is more suitable for long-term retention.
Enabling IIS logging on Azure App Service is actually a practical approach, especially when you need to troubleshoot request issues or analyze access patterns. Although App Service is a PaaS-based hosting service, it still uses IIS to handle HTTP requests at the bottom, so retaining IIS logs can provide a lot of valuable information.

How to enable IIS logs in Azure App Service
Azure App Service does not permanently save IIS logs by default, but you can enable them through the portal or ARM template and select the location where the logs are stored. The operation path is as follows:
- Enter your App Service Resources
- Find the "App Service logs" menu
- Check "File System" or "Blob Storage" in the "IIS logs" section
If you want the logs to be retained for a long time, it is recommended to choose Blob Storage. This not only saves local disk space, but also facilitates subsequent analysis and archiving.

Tip: The IIS logs are scrolled by day by day by default, and the file name format is
yyyymmdd
. Each line represents an HTTP request, including client IP, user agent, response status code and other information.
What is the content of the IIS log?
The default records of IIS logs include:

- Client IP address (Client IP)
- User-Agent
- Request method (GET/POST, etc.)
- Request URL and query string
- Response status code (such as 200, 404, 500)
- Server processing time
- The amount of data sent and received
These fields are very helpful for troubleshooting errors, analyzing traffic sources, and identifying crawler behavior. For example, you may find that some IPs access a specific interface at high frequency, or that a User-Agent constantly attempts illegal paths.
If you want to customize the log format, such as adding fields such as Host header, protocol version, etc., you can do it by modifying the applicationHost.xdt
file (suitable for advanced configuration).
How to view and download IIS logs
Once IIS logging is enabled, the next step is to view and get this data. There are several common ways to use:
- Kudu console : Go to
https://<your-site>.scm.azurewebsites.net</your-site>
and navigate to the LogFiles directory to view the real-time log file. - Download logs in Blob storage : If you configure log upload to Blob, you can download them directly through the portal or Azure Storage Explorer.
- Use the Log Stream tool : Turn on the "Log stream" function in the portal to view IIS log output in real time (file system logs only).
It should be noted that the log directory space on the App Service is limited (usually up to 100MB), so if it is just a short-term debugging, it is enough to use the local file system; but if you want to retain it for a long time, it is still recommended to use Blob.
Basically that's it. Turning on IIS logs is not complicated, but they are easily overlooked, especially developers who are new to Azure App Service. Just remember a few key set points and you can easily get the request details you need.
The above is the detailed content of IIS logging on Azure App Service. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

To limit the size of client requests, the maxAllowedContentLength parameter can be modified in web.config, such as setting it to 104857600 (100MB), and synchronizing the maxRequestLength of ASP.NET at the same time; to reasonably set the connection timeout time, it can be modified through the IIS manager or appcmd.exe command, with the default of 120 seconds, and the API scenario is recommended to set it to 30-90 seconds; if the request queue is full, you can increase MaxClientConn and QueueLength, optimize application performance, and enable load balancing to relieve stress.

HighCPUusageinIISworkerprocessesistypicallycausedbyinefficientcode,poorconfiguration,orunexpectedtrafficpatterns.Todiagnosetheissue,firstidentifythespecificw3wp.exeprocessusinghighCPUviaTaskManagerorResourceMonitoranddetermineitsassociatedapplication

Yes,youcanuseARRwithIISasareverseproxybyfollowingthesesteps:firstinstallARRandURLRewriteviaWebPlatformInstallerormanually;nextenableproxyfunctionalityinIISManagerunderARRsettings;thenconfigurereverseproxyrulestospecifywhichrequeststoforwardtobackends

When configuring dynamic compression in IIS, selecting content types reasonably can improve performance. First enable the dynamic compression module, install and configure web.config or IIS manager through the server manager. Secondly, set appropriate content types, such as HTML, CSS, JavaScript, and JSON, text content is suitable for compression, while pictures and videos are not suitable. Finally, pay attention to the impact of client compatibility and performance, monitor CPU load, client support status and small file compression effects, and adjust the configuration based on actual traffic to obtain the best benefits.

ToenableandcustomizedirectorybrowsinginIIS,firstinstallandenabletheDirectoryBrowsingfeatureviaServerManagerandIISManager;next,customizetheappearanceusingheaderandfooterHTMLsnippets;thenconfiguredefaultdocumentstopreventunintendeddirectorylistings;fin

Configuring HTTP response headers in IIS to optimize cache and improve security can be achieved by setting cache-related headers and adding security response headers. 1. Set cache-related headers: By configuring the clientCache element in the web.config file, set the Cache-Control and Expires headers for static resources, for example, use cacheControlMaxAge to specify the cache time, and fine-grained control can also be performed for specific file types (such as .jpg), but avoid HTML page caching for too long. 2. Add security-related headers: Configure X-Content-Type-Optio through customHeaders in web.config

VirtualdirectoriesandapplicationsinIISdifferinindependenceandconfiguration.1.Virtualdirectoriesactasaliasestoexternalcontent,sharingtheparentsite’sapplicationpoolandconfiguration,idealfororganizingstaticfileswithoutduplication.2.Applicationsrunindepe

To solve the IIS application pool authentication account permission problem, first, you need to confirm the identity account used by the application pool. The default is IISAppPool{AppPoolName}, which can be viewed or modified through the IIS manager; secondly, make sure that the account has corresponding permissions to the website physical path (such as D:\MyWebSite). The operation steps are: Right-click the folder → Properties → Security → Edit → Add the corresponding account and set the read, write and other permissions; common errors such as 401.3 is due to lack of read permission, 500.19 may be due to insufficient permissions for web.config file, and failure to upload may be due to lack of write permissions; pay attention to whether the inheritance permissions are effective, the UNC path needs to be configured with a username and password, and it may be necessary to modify it after the username and password.
