Alerts based on Analytics query using Custom log search

Developer Support

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:

  1. Number of results. Single alert created when the number of the records returned exceed a specified number.
  2. 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 aa1
  • Write your own query and hit Run For example –

    requests
    | project name, url, success 
    | where success == "False"

    This will return all the failed requests in my App Insights within the specified time range aa2

  • On the top-right corner, click on “+ New Alert ruleaa3
  • Under the Condition section, click on the current condition that says “Whenever the custom log search is <logic undefined>aa4
  • Specify the condition by choosing the Based on, condition, Threshold, Period and Frequency parameters and then click Done aa5

  • Configure the Action Group as you do in any alert aa6
  • 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

0 comments

Discussion is closed.

Feedback usabilla icon