Compartir a través de


Enable and Activate Failed Request Tracing Rules

This article has been moved to its new home here: https://benperk.github.io/msdn/2012/2012-01-enable-and-activate-failed-request-tracing-rules.html

There is a new troubleshooting capability available in IIS 7, it is called Failed Request Tracing Rules.  It provides a lot of very useful information which can help pinpoint the cause of performance problem or error. At the moment it is not installed by default and you may see the setting as shown in Figure 1, so to begin you need to open Server Manager, Select Roles, then within the Web Server (IIS) section, select Add Role Services.

Figure 1, default logging settings

In the Add Role Services window select both Logging Tools and Tracing, as shown in Figure 2, then select Next -> Install.

Figure 2, Installing Logging and Failed Request Tracing

Once installed you should find the following 2 new icons, shown in Figure 3, in the Features View pane of IIS after you close and reopen the IIS manager.

Figure 3, Tracing and Logging icons

Select the Web Site which you want to enable Failed Request Tracing.  Once selected, on the Actions Pane, you will see a Failed Request Tracing… link as shown in Figure 4.  Select the link.

Figure 4, Configure Failed Request Tracing for a web site

Clicking the link will open the window shown in Figure 5.  Select the check box to enable this capability for the selected web site.

Figure 5, Enable Failed Request Tracing for a web site

After the check box is selected, you will be able to set the location where you want the logs to be stored and the maximum number of files.  Once enabled, select OK.

With the same Web Site, double-click the Failed Request Tracing Rules.  This will open a view which allows the administrator to create a rule.  To create a Rule, select the Add… link from within the Actions Pane as shown in Figure 6.

Figure 6, Add a Failed Request Tracing Rule

In situations where you are not sure where the problem is, I create a “catch-all” rule, which will simply log all the activities happening.  Then I can go through the logs, 1-by-1 to find the errors.  When doing this keep the following in mind:

  1. There may be a lot of files, too many to walk through manually.  If this is the case, try to reduce the number of files by making the rule more restrictive
  2. The amount of space taken to store the logs may get large fast.  Therefore, leave the logging Enabled for just the time you need it or implement a logging storage strategy.
  3. Doing so much logging may impact the performance of your system.  So leave logging enabled for only as long as you need it or take the precautions necessary to prevent performance issues related to logging

If you do have a lot of Failed Request Tracing logs you can find a useful tool here for parsing through them faster.

That aside, after selecting the Add…link from the Actions Pane you are presented with the window shown in Figure 7.

Figure 7, Step 1 – Specify Content to Trace

As mentioned, this example is a catch all, therefore All content (*) is selected, then select Next. Selecting Next will open the window shown in Figure 8, where you can add the trace conditions.  In this example, I have decided to capture the range of status codes from 200-999.  Again, this is a “catch all”.  I want to capture 200, which means request OK, because although the response was successful, it may be taking a long time to process.  The Failed Request Tracing log will show me where the request is taking the most amount of time.  Enter the status codes you would like to capture and select Next.

You see that it is also possible to set a condition base on Time Taken or Event severity.  These are very good conditions to enable and leave running.  Just be sure to have a logging strategy in place if you leave logging turned on for a long period of time.

Figure 8, Step 2 – Define Trace Conditions

Lastly, Figure 9 provides the capability to modify the Verbosity of the logs.  I will not change any setting in this example, so select Finish to complete the addition of this rule.

Figure 9, Step 3 – Select Trace Providers

You see in Figure 10, that the rule has been added and is now logging.

Figure 10, Railed Request Tracing Rules list

If your web site is already having traffic then you can go to the directory you chose to store the logs into in Figure 5 and begin your analysis.  You can then access your web
site and reproduce the error.

Just don’t forget to turn off or manage the log files you are creating, they can have impact on performance if they grow unmanaged.

Comments

  • Anonymous
    February 02, 2015
    Excellent

  • Anonymous
    February 08, 2015
    Fantastic, thank you.

  • Anonymous
    June 05, 2015
    Can you elaborate on the performance penalty of un-managed log files?

  • Anonymous
    July 29, 2015
    @Joud, the writting of IIS logs is not real time, the logs are stored in memory and at some point the IIS logs are written.  The process is different than the one responding to web requests.  So I would not expect the logging to have significant direct negative impact on the responding of a request.  BUT, do manage the size of the files.  The resource required to write logs to a 1MB file would be less than writting to a 10GB file, so manage your IIS logs appropriately.

  • Anonymous
    November 06, 2015
    Is good patterns enable FRT in Production? FRT stackoverflow.com/.../iis-failed-request-tracing-performance-view-doesnt-show-time-spent blogs.msdn.com/.../troubleshooting-a-performance-issue-with-failed-request-tracing-and-appcmd-in-iis7.aspx serverfault.com/.../keep-iis7-failed-request-tracing-as-a-sysadmin-only-diagnostic-tool

  • Anonymous
    April 26, 2017
    Can this approach be used to also capture the response? If so is there anything special one needs to do enable response capture ?

    • Anonymous
      April 26, 2017
      The comment has been removed
  • Anonymous
    October 01, 2017
    Excellent goods from you, man. I have keep in mind your stuff previous to and you're simply extremely magnificent.I actually like what you have received right here, certainly like what you're stating and the best way through which you assert it.You're making it enjoyable and you continue to care for to keep it wise.I can't wait to read much more from you. This is really a tremendous web site.