Alerts based on Analytics query using Custom log search
Premier Developer Consultant Adel Ghabboun explores how to create alerts based on data analytics queries using Custom Log Search.
One feature was removed in Application Insights called Scheduled Analytics, and now it is replaced with Custom Log Search which allows us to create an Alerts based on data analytics queries.
Custom log search in Application Insights can be of two types:
- – Number of results. Single alert created when the number of the records returned exceed a specified number.
- – Metric measurement. Alert created for each object in the results of the log search with values that exceed specified threshold.
In this Blog, will show you the easiest way to create a custom log search in Application Insights using the Number of result type.
- On the overview tab, click on Analytics button
- Write your own query and hit Run
For example –
requests | project name, url, success | where success == "False"
- On the top-right corner, click on “+ New Alert rule”
- Under the Condition section, click on the current condition that says “Whenever the custom log search is <logic undefined>”
- Specify the condition by choosing the Based on, condition, Threshold, Period and Frequency parameters and then click Done
- Configure the Action Group as you do in any alert
- After you are done, you should receive a notification every time the condition is met. In the above scenario whenever the number of records returned is more than 3 records.
References: Log Alerts in Azure Monitor