Monitoring a function for a minimum number of succesful runs over a week.

Anonymous
2022-11-25T11:17:02.123+00:00

I need to setup up alerting to alert if a function runs less than 5 times per week. It's using a blob trigger.

I cannot monitor for failures as we may not get sent the blobs, so the function would just not run and not trigger an alert.

Any ideas how to do this?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,014 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,637 questions
0 comments No comments
{count} votes

Accepted answer
  1. Maxim Sergeev 6,566 Reputation points Microsoft Employee
    2022-11-26T06:03:49.837+00:00

    Hi there,

    Yes. Log-based alerts are limited to up 2 days.
    If you need a result with a longer time range, as a workaround you can create and run your query in LogicApps and to trigger a notification via LogicApps to where and when you need.

    https://learn.microsoft.com/en-us/azure/azure-monitor/logs/logicapp-flow-connector

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Carlos Solís Salazar 17,786 Reputation points MVP
    2022-11-25T12:41:38.38+00:00

    Hi @Anonymous

    Thank you for asking this question on the **Microsoft Q&A Platform. **

    First, add a log analytics workspace to your Function App

    Then you must create an alert role with the signal "Custom log search"
    264176-image.png

    If you have this message
    264246-image.png
    is because you might not already configure the log analytics or still you don't have data on it.

    Here you must create a query that gives the result that you require.

    After creating the query, you can configure the parameter of your alert.

    Hope this helps!

    ----------

    Accept Answer and Upvote, if any of the above helped, this thread can help others in the community looking for remediation for similar issues.
    NOTE: To answer you as quickly as possible, please mention me in your reply.

    0 comments No comments

  2. Anonymous
    2022-11-25T13:51:17.987+00:00

    Hi @Carlos Solís Salazar ,

    That approach only allows for the evaluation of logs over a maximum of two days.

    264312-image.png

    0 comments No comments