Search code examples
azurealertazure-application-insightsazure-monitor

Application Insights alert for no log is written


I try to create a azure alert rule which should be triggered in case my service do not log anything.

I created a query to check if my service logs something. This works fine until there are no logs in the specified time (e.g. give the provided query a filter criteria for the timestamp).

Query: customEvents | where name == 'ShouldBeLoged' | limit 1 This query will just give me the query result: No results found from the last 24 hours.

If create a alert of this query the alert view shows me this (see picture): enter image description here enter image description here

Has someone an idea how I could achieve that the alert is triggered in case the service do not log anything?


Solution

  • Follow the workaround to trigger the alert if the threshold value less than 1(Means no log written):

    Here I am fetching the one Limit value of custom event. enter image description here

    Workaround follows

    Create alert with threshold if it less than 1 mean it will fire the alert Here the query we used to fetch the single custom event. enter image description here

    We fetch single custom event, so we check the threshold value is less than 2 (it will fire if the event values is less than 2). enter image description here

    Result

    enter image description here