Monitoring Azure Web Apps

Monitoring Web Apps

Once you have enabled application and site diagnostic logs, you must download the logs to examine the recorded data. In addition, you can use the MONITOR tab in the Azure portal to profile a website’s performance.

Accessing Diagnostic Logs

The application and site diagnostic logs can be accessed by using FTP. An FTP link is provided in the Quick Glance section of each website’s DASHBOARD tab. You can use these links in your web browser or copy them into a dedicated FTP client such as CoreFTP. To access the logs, you must authenticate with the deployment credentials you configured for FTP and Git.

The logs are located in the following folders:

  • Application Logs: /LogFiles/Application
  • Detailed Error Logs: /LogFiles/DetailedErrors
  • Failed Request Traces: /LogFiles/W3SVC#########/
  • Web Server Logs: /LogFiles/http/RawLogs

To examine the Failed Request Traces , ensure you download both XML and XSL files to the same folder. You can then open the XML files in Internet Explorer.

Instead of using FTP, you can also download the logs by using the Save-AzureWebsiteLog PowerShell cmdlet :

Downloading Website Logs in PowerShell

    Save-AzureWebsiteLog -Name MyWebsite -Output .\

Finally, you can use the Azure cross-platform command line interface to download logs :

Using the X-Plat-CLI to Download Logs

    Azure site log download MyWebsite

Diagnostic logs are easy to understand but can be challenging to analyze when they contain a large quantity of data. One way to analyze diagnostic logs is to use HDInsight.

Monitoring Sites in the Portal

The Azure portal also includes a MONITOR tab for every website. You can use this to view performance counters that describe how your website uses resources such as CPU time and network traffic.

Monitoring Sites in the Portal

By default the counters include:

  • CPU Time
  • Data In
  • Data Out
  • HTTP Server Errors

Other metrics that you can add to the graph include:

  • Average Response Time
  • Various HTTP error type counts
  • HTTP Successes

By adding these counters and displaying them in the graph, you can examine how demand and website response has varied over the hour, 24 hours, or seven days.

You can also set alerts that can trigger an email when a counter exceeds a threshold. Typically, you would use alerts to automatically notify your team of administrators when there is a demand spike or some other performance issue.

Metrics to Monitore Web Apps

To add an alert, follow these steps:

  1. In Azure full portal, in the navigation on the left, click WEBSITES and then click the website you want to monitor.
  2. Click the MONITOR tab.
  3. Select the metric you would like to add an alert to.
  4. In the toolbar at the bottom, click ADD RULE.
  5. In the NAME text box, type a descriptive name and then click Next.
  6. In the CONDITION drop-down list, select a condition, such as greater than.
  7. In the THRESHOLD text box, type the value that should trigger the alert.
  8. In the ALERT ELEVATION WINDOW drop-down list, select the time period over which the value should exceed the threshold.
  9. Select the Send an email to the service administrator and co-administrators, and then click Complete.