An Overview Of IIS 7.5 Feature - Logging

In this article, we will look into one of the features of IIS 7.5 that helps in logging HTTP web requests coming to a web site, which includes details like user name, user agent, time taken etc. This information is very useful in troubleshooting and performance tuning a web site.

You can see my previous articles on IIS 7.5 Feature:

Let’s open IIS 7.5 manager and check whether Logging module is present or not under IIS section as shown below:

Logging

If it does not exist, we can install same by going “Turn on or off Windows Feature” in Control Panel and selecting same under Internet Information Services, WWW Services, Health and Diagnostics, then click HTTP Logging.

HTTP Logging

Let’s select “Default Web Site”, double-click on Logging and understand its settings:

Default Web Site

Let’s click on Enable under actions pane to log all HTTP requests coming to Default Web Site.

We can select Log file format:

  • W3C: This is ASCII text-based format, handled by HTTP.sys and can customize fields to be logged by clicking “Select Fields”. Fields are separated by spaces and time recorded in UTC.

  • IIS: This is ASCII text-based format, handled by HTTP.sys and fields cannot be customized Fields are separated by commas and time recorded in local time.

  • NCSA: This is fixed ASCII text-based format, handled by HTTP.sys and fields cannot be customized. Fields are separated by spaces and time recorded in local time.

  • Custom: To use a custom format for a custom logging module and can’t be configured from IIS Manager.

Let’s select W3C format and customize fields (Select Cookie) by clicking on “Select Fields”:

Select Cookie

Specify a path to store log files and select whether IIS to create a new log file daily or weekly or on reaching specific log file size.

Let’s click Apply and browse Default web site than open log file present under:

%SystemDrive%\inetpub\logs\LogFiles.



We can see details like date time, HTTP status, sub status code, cookies, URL of all requests coming to Default Web Site.

Instead of IIS Manager, We can use appcmd.exe to configure it with below command:

appcmd set config /section:httpLogging /dontLog:True [This will disable logging at server level].



We can use Log parser and its Studio to analyze and filter IIS logs:



We can select log files and write a query to extract results like TOP 20 slow URLs, no. of requests per hour etc.

I am ending things here on Logging, I hope this article will be helpful for all. 

Read more articles on IIS:


Similar Articles