Azure App Service monitoring overview
Azure App Service provides several monitoring options for monitoring resources for availability, performance, and operation. Options such as Diagnostic Settings, Application Insights, Log stream, Metrics, Quotas and alerts, and Activity logs. This article aims to bring clarity on monitoring options on App Service and provide scenarios when each should be used.
Diagnostic Settings (via Azure Monitor)
Azure Monitor is a monitoring service that provides a complete set of features to monitor your Azure resources in addition to resources in other clouds and on-premises. The Azure Monitor data platform collects data into logs and metrics where they can be analyzed. App Service monitoring data can be shipped to Azure Monitor through Diagnostic Settings.
Diagnostic settings lets you export logs to other services, such as Log Analytics, Storage account, and Event Hubs. Large amounts of data using SQL-like Kusto can be queried with Log Analytics. You can capture platform logs in Azure Monitor Logs as configured via Diagnostic Settings, and instrument your app further with the dedicated application performance management feature (Application Insights) for additional telemetry and logs.
For an end-to-end tutorial on Diagnostic Settings, see the article Troubleshoot an App Service app with Azure Monitor.
Quotas and alerts
Apps that are hosted in App Service are subject to certain limits on the resources they can use. The limits are defined by the App Service plan that's associated with the app. Metrics for an app or an App Service plan can be hooked up to alerts.
Build visualizations of metrics on Azure resources (web apps and App Service Plans). Metrics can be viewed by aggregates on data (ie. average, max, min, etc), instances, time range, and other filters. Metrics can monitor performance, memory, CPU, and other attributes.
View a historical log of events changing your resource. Resource events help you understand any changes that were made to your underlying web app resources and take action as necessary. Event examples include scaling of instances, updates to application settings, restarting of the web app, and many more.
Application Insights (via Azure Monitor)
Application Insights, a feature of Azure Monitor, is an extensible Application Performance Management (APM) service for developers and DevOps professionals. Use it to monitor your live applications. It will automatically detect performance anomalies, and includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app. The logs in Application Insights are generated by application code.
Log stream (via App Service Logs)
Azure provides built-in diagnostics to assist during testing and development to debug an App Service app. Log stream can be used to get quick access to output and errors written by your application, and logs from the web server. These are standard output/error logs in addition to web server logs.
The table below lists monitoring methods to use for different scenarios.
|I want to monitor platform metrics and logs||(Azure Monitor) Diagnostic Settings|
|I want to monitor application performance and usage||(Azure Monitor) Application Insights|
|I want to monitor built-in logs for testing and development||Log stream|
|I want to monitor resource limits and configure alerts||Quotas and alerts|
|I want to monitor web app resource events||Activity Logs|
|I want to monitor metrics visually||Metrics|