This blog post was co-authored by Vijay Nagarajan, Senior Program Manger and Kiran Madnani, Principal PM Manager, Azure Infrastructure Management
Application Insights is an extensible application performance management (APM) service for web developers on multiple platforms. Customers use Application Insights to monitor live web applications, detect performance anomalies, diagnose issues and to understand usage patterns. In addition to the alerts on application health based on different metrics, you can now monitor e-log files by setting up a query to run at specified intervals and trigger alerts based on the result. For example, let’s say you deployed a new fix for a specific exception and want to make sure it doesn’t surface again. You can now setup an alert to trigger if that exception appears in your Application Insights trace file.
Log Alerts for Application Insights can be accessed from the new Azure Alerts experience. Learn more about Azure Alerts (preview). Create a new alert and specify the target resource to be Application Insights:
Log Analytics customers will find a familiar interface for creating alerts. Much like Log Analytics, log alerts support two types:
- Number of Records: Triggers alerts based on the number of records returned for query on Application Insights. For example: Want an alert every time your webapp gives a 500 response. Create a log alert of type number of records and threshold set as one with query: requests | where resultCode == "500"
- Metric Measurement: Triggers alerts based on pattern of numeric value aggregated by the query on Application Insights. For example, want an alert if duration of your ping/availability tests on Application Insights across regions is on average very high for two consecutive periods of 15 minutes. Create a log alert of type metric measurement with trigger on continuous breach more than two and aggregation on AggregateValue with query: availabilityResults | summarize AggregatedValue = avg(duration) by bin(timestamp, 15m)
More details on log alerts can be found in Microsoft Azure Documentation for Log Alerts. Here is a short video to help you get started with Log Alerts for Application (preview).