0

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

spuppett
  • 547
  • 10
  • 26

2 Answers2

1

You should be able to build an alert using a custom condition with Number of Results = 0. https://learn.microsoft.com/en-us/azure/azure-monitor/app/alerts#how-to-set-an-exception-alert-using-custom-log-search

E.g. you build a query for logs from your function within the last 24h. If your Function ran, the query will have results. If not, result count will be 0 and you fire your alert.

silent
  • 14,494
  • 4
  • 46
  • 86
1

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.

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60