App Service Web Apps provide monitoring functionality for Standard and Premium App Service plans via the Monitor management page. The Monitor management page provides performance statistics for a web app as described below.
In the Azure Portal, from the web app's Management pages, click the Monitor tab to display the Monitor management page. By default the chart on the Monitor page displays the same metrics as the chart on the Dashboard page.
To view additional metrics for the web app, click Add Metrics at the bottom of the page to display the Choose Metrics dialog box.
Click to select additional metrics for display on the Monitor page.
After selecting the metrics that you want to add to the Monitor page, click the check mark at the bottom.
After adding metrics to the Monitor page, click to enable / disable the round checkbox next to each metric to add / remove the metric from the chart at the top of the page.
To remove metrics from the Monitor page, select the metric that you want to remove and then click the Delete Metric icon at the bottom of the page.
In Standard web app mode, you can receive alerts based on your web app monitoring metrics. The alert feature requires that you first configure a web endpoint for monitoring, which you can do in the Monitoring section of the Configure page. On the Settings page of the Azure Management Portal, you can then create a rule to trigger an alert when the metric you choose reaches a value that you specify. You can also choose to have email sent when the alert is triggered. For more information, see How to: Receive Alert Notifications and Manage Alert Rules in Azure.
Web apps can be configured to run in either Shared or Standard mode from the web app's Scale management page. Each Azure subscription has access to a pool of resources provided for the purpose of running up to 100 web apps per region in Shared mode. The pool of resources available to each web app subscription for this purpose is shared by other web app in the same geo-region that are configured to run in Shared mode. Because these resources are shared for use by other web apps, all subscriptions are limited in their use of these resources. Limits applied to a subscription's use of these resources are expressed as usage quotas listed under the usage overview section of each web app's Dashboard management page.
When a web app is configured to run in Standard mode, it is allocated dedicated resources equivalent to the Small (default), Medium or Large virtual machine sizes in the table at Virtual Machine and Cloud Service Sizes for Azure. There are no limits to the resources a subscription can use for running web apps in Standard mode. However, the number of Standard mode web apps that can be created per region is 500.
To determine the extent that a web app is impacting resource usage quotas, follow these steps:
Under the usage overview section the usage quotas for your respective App Service plan are displayed, which is a subset of the following:
Some quotas can be applied per web hosting plan, while others can be applied per site. For detailed information on usage quotas for each Web hosting plan, see Websites Limits.
Quotas are not a matter of performance or cost, but it's the way Azure governs resource usage in a multitenant environment by preventing tenants from overusing shared resources. Since exceeding your quotas means downtime or reduced functionality for your web app, consider the following if you want to keep your site running when quotas are about to be reached:
Diagnostics are enabled on the Configure management page for the web app. There are two types of diagnostics: application diagnostics and site diagnostics.
The application diagnostics section of the Configure management page controls the logging of information produced by the application, which is useful when logging events that occur within an application. For example, when an error occurs in your application, you may wish to present the user with a friendly error while writing more detailed error information to the log for later analysis.
You can enable or disable the following application diagnostics:
Application Logging (File System) - Turns on logging of information produced by the application. The Logging Level field determines whether Error, Warning, or Information level information is logged. You may also select Verbose, which will log all information produced by the application.
Logs produced by this setting are stored on the file system of your web app, and can be downloaded using the steps in the Downloading log files for a web app section below.
Application Logging (Table Storage) - Turns on the logging of information produced by the application, similar to the Application Logging (File System) option. However, the log information is stored in an Azure Storage Account in a table.
To specify the Azure Storage Account and table, choose On, select the Logging Level, and then choose Manage Table Storage. Specify the storage account and table to use, or create a new table.
The log information stored in the table can be accessed using an Azure Storage client.
Application Logging (Blob storage) - Turns on the logging of information produced by the application, similar to the Application Logging (Table Storage) option. However, the log information is stored in a blob in an Azure Storage Account.
To specify the Azure Storage Account and blob, choose On, select the Logging Level, and then choose Manage Blob Storage. Specify the storage account, blob container, and blob name to use, or create a new container and blob.
For more information about Azure Storage Accounts, see How to Manage Storage Accounts.
Since application logging to storage requires using a storage client to view the log data, it is most useful when you plan on using a service or application that understands how to read and process the data directly from Azure Table or Blob Storage. Logging to the file system produces files that can be downloaded to your local computer using FTP or other utilities as described later in this section.
Application diagnostics (file system), Application diagnostics (table storage), and Application diagnostics (blob storage) can be enabled at the same time, and have individual log level configurations. For example, you may wish to log errors and warnings to storage as a long-term logging solution, while enabling file system logging with a level of verbose after instrumenting the application code in order to troubleshoot a problem.
Diagnostics can also be enabled from Azure PowerShell using the Set-AzureWebsite cmdlet.
If you have not installed Azure PowerShell, or have not configured it to use your Azure Subscription, see How to Use Azure PowerShell.
Application logging relies on log information generated by your application. The method used to generate log information, as well as the format of the information is specific to the language your application is written in. For language-specific information on using application logging, see the following articles:
Application logging to table or blob storage is only supported for .NET applications.
The site diagnostics section of the Configure management page controls the logging performed by the web server, such as the logging of web requests, failure to serve pages, or how long it took to serve a page. You can enable or disable the following options:
To save web server logs to an Azure Storage Account, choose Storage, and then choose manage storage to specify a storage account and an Azure Blob Container where the logs will be kept. For more information about Azure Storage Accounts, see How to Manage Storage Accounts.
To save web server logs to the file system, choose File System. This enables the Quota box where you can set the maximum amount of disk space for the log files. The minimum size is 25MB and the maximum is 100MB. The default size is 35MB.
By default, web server logs are never deleted. To specify a period of time after which the logs will be automatically deleted, select Set Retention and enter the number of days to keep the logs in the Retention Period box. This setting is available for both the Azure Storage and File System options.
Detailed Error Messages - Turn on detailed error logging to log additional information about HTTP errors (status codes greater than 400).
Failed Request Tracing - Turn on failed request tracing to capture information for failed client requests, such as a 400 series HTTP status code. Failed request tracing produces an XML document that contains a trace of which modules the request passed through in IIS, details returned by the module, and the time the module was invoked. This information can be used to isolate which component the failure occurred in.
After enabling diagnostics for a web app, click the Save icon at the bottom of the Configure management page to apply the options that you have set.
Logging and tracing place significant demands on a web app. We recommend turning off logging and tracing once you have reproduced the problem(s) that you are troubleshooting.
Diagnostics can be further modified by adding key/value pairs to the app settings section of the Configure management page. The following settings can be configured from app settings:
The location in which application logs will be saved, relative to the web root.
Default value: ..\..\LogFiles\Application
The maximum buffer size to use when capturing application logs. Information is initially written to the buffer before being flushed to file or storage. If new information is written to the buffer before it can be flushed, you may lose previously logged information. If your application produces large bursts of log information, consider increasing the size of the buffer.
Default value: 10MB
The maximum size of the Application folder in which application diagnostics written to file are stored.
Default value: 1MB
Log files can be downloaded using either FTP, Azure PowerShell, or the Azure CLI.
From the Start Screen or the Start Menu, search for Azure PowerShell. Right-click the Azure PowerShell entry and select Run as Administrator.
If Azure PowerShell is not installed, see Getting Started with Azure PowerShell Cmdlets for installation and configuration information.
From the Azure PowerShell prompt, use the following command to download the log files:
Save-AzureWebSiteLog -Name webappname
This will download the log files for the web app specified by webappname and save them to a log.zip file in the current directory.
You may also view a live stream of log events by using the following command:
Get-AzureWebSiteLog -Name webappname -Tail
This will display log information to the Azure PowerShell prompt as they occur.
Open a new command prompt, PowerShell, bash, or terminal session, and use the following command to download the log files:
azure site log download webappname
This will download the log files for the web app specified by webappname and save them to a log.zip file in the current directory.
You may also view a lie stream of log events by using the following command:
azure site log tail webappname
This will display log information to the command prompt, PowerShell, bash or terminal session that the command is ran from.
If the azure command is not installed, see How to use the Azure CLI for installation and configuration information.
The log files that are generated after you have enabled logging and / or tracing for a web app vary depending on the level of logging / tracing that is set on the Configure management page for the web app. Following are the location of the log files and how the log files may be analyzed:
Log File Type: Application Logging
Location /LogFiles/Application/. This folder contains one or more text files containing information produced by application logging. The information logged includes the date and time, the Process ID (PID) of the application, and the value produced by the application instrumentation.
Read Files with: A text editor or parser that understands the values produced by your application
Log File Type: Failed Request Tracing
Location: /LogFiles/W3SVC#########/. This folder contains an XSL file and one or more XML files. Ensure that you download the XSL file into the same directory as the XML file(s) because the XSL file provides functionality for formatting and filtering the contents of the XML file(s) when viewed in Internet Explorer.
Read Files with: Internet Explorer
Log File Type: Detailed Error Logging
Location: /LogFiles/DetailedErrors/. The /LogFiles/DetailedErrors/ folder contains one or more .htm files that provide extensive information for any HTTP errors that have occurred.
Read Files with: Web browser
The .htm files include the following sections:
Detailed Error Information: Includes information about the error such as Module, Handler, Error Code, and Requested URL.
Most likely causes: Lists several possible causes of the error.
Things you can try: Lists possible solutions for resolving the problem reported by the error.
Links and More Information: Provides additional summary information about the error and may also include links to other resources such as Microsoft Knowledge Base articles.
Log File Type: Web Server Logging
Location: /LogFiles/http/RawLogs. The information stored in the files is formatted using the W3C extended log format. The s-computername, s-ip and cs-version fields are not used by Azure web apps.
Read Files with: Log Parser. Used to parse and query IIS log files. Log Parser 2.2 is available on the Microsoft Download Center at http://go.microsoft.com/fwlink/?LinkId=246619.
This feature, available in Standard mode, lets you monitor up to 2 endpoints from up to 3 geographic locations.
Endpoint monitoring configures web tests from geo-distributed locations that test response time and uptime of web URLs. The test performs an HTTP get operation on the web URL to determine the response time and uptime from each location. Each configured location runs a test every five minutes.
Uptime is monitored using HTTP response codes, and response time is measured in milliseconds. Uptime is considered 100% when the response time is less than 30 seconds and the HTTP status code is lower than 400. Uptime is 0% when the response time is greater than 30 seconds or the HTTP status code is greater than 400.
After you configure endpoint monitoring, you can drill down into the individual endpoints to view details response time and uptime status over the monitoring interval from each of the test locations. You can also set up an alert rule when the endpoint takes too long to respond, for example.
To configure endpoint monitoring:
Click Save. It may take some time for the web endpoint monitoring data to be available on the Dashboard and Monitor tabs.
To create an email rule, do the following:
In the service bar at the far left, click Management Services.
Click Add Rule at the bottom.
In Service Type, select Web App, then select the web app for which you configured endpoint monitoring earlier. Click Next.
In Metric, you can now select additional metrics for the endpoint you configured. For example: Response Time (homepage/US: IL-Chicago). Select the Response Time metric and type 3 in Threshold Value to specify a 3-second threshold.
Select Send an email to the service administrator and co-administrators. Click Complete.
Azure will now actively monitor the endpoint and send an email alert when it takes more than 3 seconds to reply.
For more on web app endpoint monitoring, see the following videos:
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.