You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为Azure Logic App创建24小时周期的运行成功次数告警?

解决Azure Logic App 24小时周期告警的可行方案

Got it, let's break down how to get around that 6-hour evaluation period limit in Azure Monitor's UI for your Logic App alert. Here are three solid workarounds that'll let you monitor 24-hour success run counts effectively:

方法1:Log Analytics工作区 + 自定义日志查询告警

This is my go-to for scenarios like this, since it leverages Azure's built-in logging capabilities:

  • First, make sure your Logic App's run logs are being sent to a Log Analytics workspace. Head to your Logic App → Monitoring → Diagnostic settings → Add a setting, select relevant log categories (like WorkflowRuntime or AzureActivity) and send them to your Log Analytics workspace.
  • Next, create a Log Alert Rule in Azure Monitor:
    1. Use this Kusto query to count successful runs over the last 24 hours (replace <YourLogicAppName> with your app's name):
      WorkflowRuntime
      | where ResourceName == "<YourLogicAppName>"
      | where Status == "Succeeded"
      | summarize SuccessfulRuns = count() by bin(TimeGenerated, 24h)
      | where SuccessfulRuns < 1
      
    2. For the alert logic, set the Evaluation period to 24 hours and the Frequency to 24 hours (so it checks once daily).
    3. Configure your notification action (email, Teams, etc.) and you're good to go. This query will trigger an alert if there are zero successful runs in the past 24 hours.

方法2:用另一个Logic App做自定义监控

If you prefer a no-code/low-code approach, spin up a dedicated monitoring Logic App:

  • Create a new Logic App with a Recurrence trigger set to run once daily (e.g., at 1 AM, right after your 24-hour window ends).
  • Add a Get Run History action targeting your original Logic App. Filter the results to only include runs with status Succeeded and set the Start time to utcNow('yyyy-MM-ddTHH:mm:ssZ', -24) to pull the last 24 hours of runs.
  • Add a Condition action to check if the number of successful runs (use the length() function on the run history output) is less than 1.
  • If the condition is met, add your notification action (Send Email, Post to Teams, etc.).
  • This method gives you full control over the timing and logic, no need to mess with Kusto queries or ARM templates.

方法3:自定义指标 + ARM模板(进阶)

If you want to stick with metric-based alerts but need the 24-hour window, you can use custom metrics and an ARM template to bypass the UI limit:

  • In your original Logic App, add a Send Metric action in the success branch of your workflow. Send a custom metric (e.g., DailySuccessfulRun) with a value of 1 to Azure Monitor.
  • Instead of using the UI to create the alert, write an ARM template for the metric alert. In the template, set the evaluationPeriod to PT24H (24 hours) and windowSize to PT24H. The UI restricts this to 6 hours, but ARM templates support longer periods.
  • Deploy the ARM template to your Azure subscription, and the alert will check the sum of your custom metric over 24 hours—if it's less than 1, it triggers.

Any of these methods will solve your problem. I'd recommend starting with Method 1 or 2 depending on your comfort with logs vs. low-code workflows.

内容的提问来源于stack exchange,提问作者PoorInRichfield

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:45:58