Search code examples
azureazure-application-insightsazure-alerts

Can I set up an Azure Application Insight alert if my function wasn't called within 24 hours?


We have a few Azure functions that we expect to get hit at least once every working day. Looking through the alerts, I'm not seeing anything that is jumping out that would alert us if there is no activity for a function.

I haven't had much luck searching for 'alert when no activity' either, so I'm wondering if any of you folks have done this or might be able to point me in the right direction.

Thank you


Solution

  • Assume you have the following azure function, and it is connected an application insights:

    enter image description here

    Then you can use the query below to check if the function instance(BlobTrigger1 in this example) is called or not in Application insights(Note that the sdkVersion may change for v1 / v2 / v3 azure function, you should check it by yourself):

    enter image description here

    Then in Azure monitor -> alerts, for "RESOURCE", select your Application insights; for "CONDITION", select "Custom log search":

    enter image description here

    Then in "Custom log search", set the setting as per screenshot below:

    enter image description here

    And configure other settings, after that you will be alerted if the function instance is not called within 24 hours.