WEBSITE

IIS 7.0 : Application Logging

5/24/2011 4:14:53 PM
Besides the standard IIS type logs, other items can be logged. Many of these options can be set with the IIS Manager or by using Appcmd.

Process Recycling Logging

In IIS 7.0, events are logged to the Windows event log when an application pool recycles. You can control eight configuration settings with each option listed in Table 1.

Table 1. Recycling Options Under Generate Recycle Event Log Entry
OptionDescriptionDefault Setting
Application Pool Configuration ChangedEvent is logged when the application pool recycles due to a change in its configurationNo
ISAPI Report UnhealthyEvent is logged because an ISAPI extension has reported itself as unhealthyNo
Manual RecycleEvent is logged when the application pool has been manually recycledNo
Private Memory Limit ExceededEvent is logged when the application pool recycles after exceeding its private memory limitYes
Regular Time IntervalEvent is logged when the application pool recycles on its scheduled intervalYes
Request Limit ExceededEvent is logged when the application pool recycles after exceeding its request limitNo
Specific TimeEvent is logged when the application pool recycles at a scheduled timeNo
Virtual Memory Limit ExceededEvent is logged when the application pool recycles after exceeding its virtual memory limitsYes

ASP

Classic ASP (Active Server Pages) is alive and well in IIS 7.0, and you can configure options for logging ASP errors under the ASP section in the IIS Manager. Use the following options to discover issues when migrating your Classic ASP applications to IIS 7.0.

  • Enable Log Error Requests Controls whether the Web server writes ASP errors to the application event log

  • Log Errors To The NT Log Specifies that ASP errors are recorded in the Windows event log

These options are available in IIS 6.0, but you have to use ADSUtil.vbs to enable them in the metabase. Now, in IIS 7.0, you can use the IIS Manager to enable these options.

ASP.NET

All ASP.NET 2.0 unhandled exceptions are written to the Application Event log. Along with application pool recycle events or other errors in the event logs, this can be very helpful in troubleshooting application errors. You can turn off ASP.NET logging by following the instructions in the Knowledge Base article at http://support.microsoft.com/kb/911816.

IIS Events

Other processes related to IIS also log to the Windows Event log. This includes the HTTP, IISAdmin, FTP Publishing Service, and W3SVC services. For a complete list of events, go to http://technet.microsoft.com and search for “IIS events reference.”

Folder Compression Option

Log files are necessary to keep track of Web site statistics and trends, and Web developers and business people use them to ensure their Web sites continue to grow. One of the biggest challenges administrators face is how to retain and manage log files. By default, IIS rolls over log files once a day. Your log files can become quite large even if you use the default log file rollover setting.

Windows Server 2008 allows for folder compression to help save space. You can enable this option by using Windows Explorer. Figure 1 shows a folder with compression enabled. In this example, the size of the folder is 166 megabytes (MB), but the actual space the folder uses on the disk is only 43.1 MB. If your uncompressed log files take up several gigabytes (GB), you could save yourself a lot of disk space by using folder compression.

Figure 1. Folder compression enabled on the WWWLogs folder.


Because HTTP.sys buffers information written to the IIS log files, there will not be a performance hit if your log files are in a folder for which compression is enabled. Some people use third-party log compression products or free tools such as Gzip along with scripts to compress their log files. Unless you have a tool that searches inside zip files, this is an acceptable method only if you rarely need to unzip and search your archived log files. If you have compression enabled, however, you can leave your files in their original, easily searchable state. At most, you’ll need to implement some type of archival and deletion script by using your favorite script or third-party program.

Using the built-in compression feature provided by Windows Server 2008 can save you disk space and simplify how you retain your log files.

Logging Analysis Using Log Parser

You can download Log Parser at http://www.iis.net/go/1287.

Note

Members of the Microsoft.com team are big fans of Log Parser. Take a look at this Web site for an article that discusses how they use Log Parser: http://blogs.technet.com/mscom/archive/2005/10/19/412745.aspx.


Here are three examples of using Log Parser to extract common information from your IIS logs:

1.
List the top 25 (most frequent) WebRequests:

LogParser -i:iisw3c "SELECT TOP 25 cs-uri-stem,
COUNT(*) AS HitCount INTO Results.csv FROM LOGFILENAME.LOG
GROUP BY cs-uri-stem ORDER BY HitCount DESC" -o:csv

2.
Show the 25 requests that take the longest to execute:

//Change the date to fit your needs
SELECT
TOP 25
CS-URI-STEM,
TIME-TAKEN
FROM LOGFILENAME.LOG
WHERE DATE > '2007-03-26'
ORDER BY TIME-TAKEN DESC

3.
Select information between two dates and pipe results to a text file named Output.txt:

SELECT
DATE,
TIME,
CS-URI-STEM,
SC-STATUS,
COUNT(*) AS MaxTime
INTO Output.txt
FROM LOGFILENAME.LOG
WHERE TO_TIME(time)
BETWEEN
TIMESTAMP('01/01 13:50:00', 'MM/dd hh:mm:ss') AND
TIMESTAMP('01/01 18:30:00', 'MM/dd hh:mm:ss') AND SC-STATUS = 500
GROUP BY
CS-URI-STEM,
DATE,
TIME,
SC-STATUS
ORDER BY MaxTime DESC

If you are responsible for maintaining an IIS environment, take a look at Log Parser. You’ll want to make it one of your main tools when troubleshooting all kinds of issues. (For more information about Log Parser, visit the community forums at http://forums.iis.net/default.aspx?GroupID=51.)

Other  
 
Most View
Exchange Server 2007 Management and Maintenance Practices : Proper Care and Feeding of Exchange Server 2007
Thermalright Archon SB-E X2 Super-Cooler Review - Evolution Apogee (Part 1)
The Audi A3 Sportback E-Tron – Too Good To Be True
Windows Server 2012 : Managing and Troubleshooting Hardware (part 6) - Viewing Advanced, Resources, and other settings
Microsoft Enterprise Library : Banishing Validation Complication - What Does the Validation Block Do? (part 2)
GPS Log Book - Record Journey Automatically In Car
PowerShell for Microsoft SharePoint 2010 : Variables in Windows PowerShell (part 1) - Working with Variables
The BMW 435i Coupé – One Small Leap (Part 2)
Thunderstruck ASUS Brings Thunderbolt 2 To Your PC (Part 3)
Asus Zenbook Prime UX51Vz – An Attractive And Sophisticated Ultrabook (Part 1)
REVIEW
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
VIDEO TUTORIAL
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
Popular Tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Top 10
3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
3 Tips for Maintaining Your Cell Phone Battery (part 1) - Charge Smart
OPEL MERIVA : Making a grand entrance
FORD MONDEO 2.0 ECOBOOST : Modern Mondeo
BMW 650i COUPE : Sexy retooling of BMW's 6-series
BMW 120d; M135i - Finely tuned
PHP Tutorials : Storing Images in MySQL with PHP (part 2) - Creating the HTML, Inserting the Image into MySQL
PHP Tutorials : Storing Images in MySQL with PHP (part 1) - Why store binary files in MySQL using PHP?
Java Tutorials : Nested For Loop (part 2) - Program to create a Two-Dimensional Array
Java Tutorials : Nested For Loop (part 1)