监视 Azure 逻辑应用的运行状态、查看其触发历史记录并为其设置警报Monitor run status, review trigger history, and set up alerts for Azure Logic Apps

创建并运行逻辑应用后,可以检查该逻辑应用的运行状态、运行历史记录触发历史记录和性能。After you create and run a logic app, you can check that logic app's run status, runs history, trigger history, and performance. 要获取关于故障或其他可能问题的通知,请设置警报To get notifications about failures or other possible problems, set up alerts. 例如,可以创建一个警报,用于检测“一小时内运行失败超过五次的情况”。For example, you can create an alert that detects "when more than five runs fail in an hour."

若要进行实时事件监视和更丰富的调试,可以使用 Azure Monitor 日志为逻辑应用设置诊断日志记录。For real-time event monitoring and richer debugging, set up diagnostics logging for your logic app by using Azure Monitor logs. 此 Azure 服务可帮助你监视云和本地环境,使你能够更轻松地维持其可用性和性能。This Azure service helps you monitor your cloud and on-premises environments so that you can more easily maintain their availability and performance. 然后,可以查找和查看事件,例如触发事件、运行事件和操作事件。You can then find and view events, such as trigger events, run events, and action events. 将此信息存储在 Azure Monitor 日志中,可以创建日志查询来帮助查找和分析此信息。By storing this information in Azure Monitor logs, you can create log queries that help you find and analyze this information. 还可以将此诊断数据与其他 Azure 服务一起使用,例如 Azure 存储和 Azure 事件中心。You can also use this diagnostic data with other Azure services, such as Azure Storage and Azure Event Hubs.

查看运行历史记录Review runs history

每次针对某个项或事件激发触发器时,逻辑应用引擎将针对每个项或事件创建并运行一个独立的工作流实例。Each time that the trigger fires for an item or event, the Logic Apps engine creates and runs a separate workflow instance for each item or event. 默认情况下,每个工作流实例并行运行,因此在启动运行之前无需等待任何工作流。By default, each workflow instance runs in parallel so that no workflow has to wait before starting a run. 可查看该次运行过程中发生的情况,包括工作流中的每个步骤的状态,以及每个步骤的输入和输出。You can review what happened during that run, including the status for each step in the workflow plus the inputs and outputs for each step.

  1. Azure 门户的逻辑应用设计器中查找逻辑应用并将其打开。In the Azure portal, find and open your logic app in the Logic App Designer.

    若要查找逻辑应用,请在 Azure 的主搜索框中输入 logic apps,然后选择“逻辑应用”。To find your logic app , in the main Azure search box, enter logic apps, and then select Logic Apps.

    查找并选择“逻辑应用”服务

    Azure 门户将显示与 Azure 订阅关联的所有逻辑应用。The Azure portal shows all the logic apps that are associated with your Azure subscriptions. 可以根据名称、订阅、资源组、位置等筛选此列表。You can filter this list based on name, subscription, resource group, location, and so on.

    查看与订阅关联的逻辑应用

  2. 选择你的逻辑应用,然后选择“概述”。Select your logic app, and then select Overview.

    在概述窗格中的“运行历史记录”下,显示了逻辑应用的所有以往、当前和任何等待中的运行。On the overview pane, under Runs history, all the past, current, and any waiting runs for your logic app appear. 如果列表显示多次运行,且你找不到所需条目,请尝试筛选列表。If the list shows many runs, and you can't find the entry that you want, try filtering the list. 如果找不到预期的数据,请尝试在工具栏中选择“刷新”。If you don't find the data that you expect, try selecting Refresh on the toolbar.

    概述、运行历史记录和其他逻辑应用信息

    逻辑应用运行的可能状态如下:Here are the possible statuses for a logic app run:

    状态Status 说明Description
    已取消Cancelled 工作流正在运行,但收到取消请求The workflow was running but received a cancel request
    失败Failed 至少一个操作失败,并且工作流中未设置任何后续操作来处理该故障At least one action failed, and no later actions in the workflow were set up to handle the failure
    正在运行Running 当前工作流正在运行。The workflow is currently running.

    工作流受限,或者当前定价计划出现问题时,也可能显示此状态。This status can also appear for throttled workflows or due to the current pricing plan. 有关详细信息,请参阅定价的操作限制页For more information, see the action limits on the pricing page. 如果设置了诊断日志记录,则可以获取发生的任何限制事件的相关信息。If you set up diagnostics logging, you can get information about any throttle events that happen.

    成功Succeeded 所有操作成功。All actions succeeded.

    注意:如果特定操作发生故障,工作流中后面的操作将处理该故障。Note: If any failures happened in a specific action, a later action in the workflow handled that failure.

    正在等待Waiting 工作流尚未启动或暂停,例如,由于前一个工作流仍在运行。The workflow hasn't started or is paused, for example, due to an earlier workflow that's still running.
  3. 若要查看特定运行的步骤和其他信息,请在“运行历史记录”下选择该运行。To review the steps and other information for a specific run, under Runs history, select that run.

    选择要查看的特定运行

    “逻辑应用运行”窗格将显示所选运行中的每个步骤、每个步骤的运行状态,以及运行每个步骤花费的时间,例如:The Logic app run pane shows each step in the selected run, each step's run status, and the time taken for each step to run, for example:

    特定运行中的每个操作

    若要以列表格式查看此信息,请在“逻辑应用运行”工具栏上选择“运行详细信息”。 To view this information in list form, on the Logic app run toolbar, select Run Details.

    在工具栏上选择“运行详细信息”

    “运行详细信息”视图显示每个步骤、其状态和其他信息。The Run Details view shows each step, their status, and other information.

    查看有关运行中每个步骤的详细信息

    例如,可以获取运行的“关联 ID”属性,在使用适用于逻辑应用的 REST API 时,可能需要此信息。For example, you can get the run's Correlation ID property, which you might need when you use the REST API for Logic Apps.

  4. 若要获取有关特定步骤的详细信息,请选择以下任一选项:To get more information about a specific step, select either option:

    • 在“逻辑应用运行”窗格中选择该步骤,使形状展开。In the Logic app run pane select the step so that the shape expands. 现在可以查看输入、输出以及该步骤中发生的任何错误等信息,例如:You can now view information such as inputs, outputs, and any errors that happened in that step, for example:

      在“逻辑应用运行”窗格中查看失败的步骤

    • 在“逻辑应用运行详细信息”窗格中选择所需的步骤。In the Logic app run details pane, select the step that you want.

      在“运行详细信息”窗格中查看失败的步骤

      现在可以查看该步骤的信息(例如输入和输出),例如:You can now view information such as inputs and outputs for that step, for example:

    备注

    所有运行时详细信息和事件都在逻辑应用服务中进行加密。All runtime details and events are encrypted within the Logic Apps service. 只有当用户请求查看该数据时,才会进行解密。They are decrypted only when a user requests to view that data. 可以在运行历史记录中隐藏输入和输出,或使用 Azure 基于角色的访问控制 (RBAC) 来控制用户对此信息的访问。You can hide inputs and outputs in run history or control user access to this information by using Azure Role-Based Access Control (RBAC).

查看触发器历史记录Review trigger history

每个逻辑应用运行都以触发器开头。Each logic app run starts with a trigger. 触发历史记录列出逻辑应用做出的所有触发尝试,以及有关每次触发尝试的输入和输出的信息。The trigger history lists all the trigger attempts that your logic app made and information about the inputs and outputs for each trigger attempt.

  1. Azure 门户的逻辑应用设计器中查找逻辑应用并将其打开。In the Azure portal, find and open your logic app in the Logic App Designer.

    若要查找逻辑应用,请在 Azure 的主搜索框中输入 logic apps,然后选择“逻辑应用”。To find your logic app , in the main Azure search box, enter logic apps, and then select Logic Apps.

    查找并选择“逻辑应用”服务

    Azure 门户将显示与 Azure 订阅关联的所有逻辑应用。The Azure portal shows all the logic apps that are associated with your Azure subscriptions. 可以根据名称、订阅、资源组、位置等筛选此列表。You can filter this list based on name, subscription, resource group, location, and so on.

    查看与订阅关联的逻辑应用

  2. 选择你的逻辑应用,然后选择“概述”。Select your logic app, and then select Overview.

  3. 在逻辑应用的菜单中,选择“概述”。On your logic app's menu, select Overview. 在“摘要”部分中的“评估”下,选择“查看触发历史记录”。 In the Summary section, under Evaluation, select See trigger history.

    查看逻辑应用的触发历史记录

    触发历史记录窗格显示逻辑应用做出的所有触发尝试。The trigger history pane shows all the trigger attempts that your logic app has made. 每次针对某个项或事件激发触发器时,逻辑应用引擎就会创建一个独立的逻辑应用实例来运行工作流。Each time that the trigger fires for an item or event, the Logic Apps engine creates a separate logic app instance that runs the workflow. 默认情况下,每个实例并行运行,因此在启动运行前无需等待任何工作流。By default, each instance runs in parallel so that no workflow has to wait before starting a run. 因此,如果逻辑应用同时针对多个项触发,则会对每个项显示具有相同日期和时间的触发器项。So if your logic app triggers on multiple items at the same time, a trigger entry with the same date and time appears for each item.

    针对不同项的多次触发尝试

    触发器尝试可能的状态如下:Here are the possible statuses for a trigger attempt:

    状态Status 说明Description
    失败Failed 出现了错误。An error occurred. 若要查看失败触发器生成的任何错误消息,请选择该触发器尝试并选择“输出”。To review any generated error messages for a failed trigger, select that trigger attempt and choose Outputs. 例如,你可能发现输入无效。For example, you might find inputs that aren't valid.
    已跳过Skipped 触发器已检查终结点,但未找到任何数据。The trigger checked the endpoint but found no data.
    成功Succeeded 触发器已检查终结点并找到可用数据。The trigger checked the endpoint and found available data. 通常,此状态还会伴随出现“已触发”状态。Usually, a "Fired" status also appears alongside this status. 如果没有,触发器定义可能未满足某一条件或 SplitOn 命令。If not, the trigger definition might have a condition or SplitOn command that wasn't met.

    此状态可应用于手动触发器、定期触发器或轮询触发器。This status can apply to a manual trigger, recurrence trigger, or polling trigger. 如果操作生成未处理的错误,尽管可以成功运行触发器,但运行本身可能仍会失败。A trigger can run successfully, but the run itself might still fail when the actions generate unhandled errors.

    提示

    可以重新检查触发器,无需等待下一个周期。You can recheck the trigger without waiting for the next recurrence. 在概述工具栏上,选择“运行触发器”并选择强制执行检查的触发器。On the overview toolbar, select Run trigger, and select the trigger, which forces a check. 或者,在“逻辑应用设计器”工具栏中选择“运行”。Or, select Run on Logic Apps Designer toolbar.

  4. 若要查看有关特定触发尝试的信息,请在触发器窗格中选择该触发事件。To view information about a specific trigger attempt, on the trigger pane, select that trigger event. 如果列表显示许多触发尝试,但你找不到所需的条目,请尝试筛选列表。If the list shows many trigger attempts, and you can't find the entry that you want, try filtering the list. 如果找不到预期的数据,请尝试在工具栏中选择“刷新”。If you don't find the data that you expect, try selecting Refresh on the toolbar.

    查看特定的触发尝试

    现在可以查看有关所选触发事件的信息,例如:You can now review information about the selected trigger event, for example:

    查看特定触发器的信息

设置监视警报Set up monitoring alerts

若要在出现特定的指标或超出逻辑应用的阈值时收到警报,请在 Azure Monitor 中设置警报To get alerts based on specific metrics or exceeded thresholds for your logic app, set up alerts in Azure Monitor. 了解 Azure 中的指标Learn about metrics in Azure. 若要在不使用 Azure Monitor 的情况下设置警报,请执行以下步骤。To set up alerts without using Azure Monitor, follow these steps.

  1. 在逻辑应用菜单中的“监视”下,选择“警报” > “新建警报规则”。 On your logic app menu, under Monitoring, select Alerts > New alert rule.

    为逻辑应用添加警报

  2. 在“创建规则”窗格中的“资源”下,如果未选择你的逻辑应用,请选择它。 On the Create rule pane, under Resource, select your logic app, if not already selected. 在“条件”下选择“添加”,以便可以定义触发警报的条件。 Under Condition, select Add so that you can define the condition that triggers the alert.

    为规则添加条件

  3. 在“配置信号逻辑”窗格中,找到并选择要接收其警报的信号。On the Configure signal logic pane, find and select the signal for which you want to get an alert. 可以使用搜索框;若要按字母顺序对信号排序,请选择“信号名称”列标题。You can use the search box, or to sort the signals alphabetically, select the Signal name column header.

    例如,若要在触发器失败时发送警报,请执行以下步骤:For example, if you want to send an alert when a trigger fails, follow these steps:

    1. 在“信号名称”列中,找到并选择“触发器失败”信号。 In the Signal name column, find and select the Triggers Failed signal.

      选择要为其创建警报的信号

    2. 在针对所选信号打开的信息窗格中的“警报逻辑”下设置条件,例如:On the information pane that opens for the selected signal, under Alert logic, set up your condition, for example:

    3. 对于“运算符”,请选择“大于或等于”。 For Operator, select Greater than or equal to.

    4. 对于“聚合类型”,请选择“计数”。 For Aggregation type, select Count.

    5. 对于“阈值”,请输入 1For Threshold value, enter 1.

    6. 在“条件预览”下,确认显示的条件正确。Under Condition preview, confirm that your condition appears correct.

    7. 在“评估依据”下,设置运行警报规则的间隔和频率。Under Evaluated based on, set up the interval and frequency for running the alert rule. 对于“聚合粒度(周期)”,请选择数据的分组周期。For Aggregation granularity (Period), select the period for grouping the data. 对于“评估频率”,请选择检查条件的频率。For Frequency of evaluation, select how often you want to check the condition.

    8. 准备就绪后,选择“完成”。When you're ready, select Done.

    下面是已完成的条件:Here's the finished condition:

    为警报设置条件

    现在,“创建规则”页会显示创建的条件以及运行该警报所需的开销。The Create rule page now shows the condition that you created and the cost for running that alert.

    “创建规则”页上的“新建警报”

  4. 指定警报的名称、可选说明和严重性级别。Specify a name, optional description, and severity level for your alert. 保持启用“创建时启用规则”设置,或者将此设置禁用到准备好启用规则为止。Either leave the Enable rule upon creation setting turned on, or turn off until you're ready to enable the rule.

  5. 完成后,选择“创建警报规则”。When you're done, select Create alert rule.

提示

要从警报运行逻辑应用,可以在工作流中包括请求触发器,从而可以执行类似以下示例的任务:To run a logic app from an alert, you can include the request trigger in your workflow, which lets you perform tasks like these examples: