แก้ไข

แชร์ผ่าน


Monitor and collect diagnostic data for workflows in Azure Logic Apps

Applies to: Azure Logic Apps (Consumption + Standard)

To get richer data for debugging and diagnosing your workflows in Azure Logic Apps, you can log workflow runtime data and events, such as trigger events, run events, and action events, that you can send to a Log Analytics workspace, Azure storage account, Azure event hub, another partner destination, or all these destinations when you set up and use Azure Monitor Logs.

Note

Azure Monitor Resource Logs aren't 100% lossless. Resource Logs are based on a store and forward architecture designed to affordably move petabytes of data per day at scale. This capability includes built-in redundancy and retries across the platform, but doesn't provide transactional guarantees. Transactional monitoring might reduce the reliability and performance of the monitored service. Also, transient logging errors must halt the upstream service when unable to confirm log delivery. Whenever the Azure Monitor team can confirm a persistent source of data loss, the team considers resolution and prevention its highest priority. However, small data losses might still happen due to temporary, non-repeating service issues distributed across Azure, and not all can be caught.

This how-to guide shows how to complete the following tasks, based on whether you have a Consumption or Standard logic app resource.

Prerequisites

Enable Log Analytics

For a Consumption logic app, you need to first enable Log Analytics.

Enable Log Analytics at logic app creation

  1. In the Azure portal, on the Create Logic App pane, follow these steps:

    1. Under Plan, make sure to select Consumption so that only the options for Consumption workflows appear.

    2. For Enable log analytics, select Yes.

    3. From the Log Analytics workspace list, select the workspace where you want to send the data from your workflow run.

      Screenshot showing the Azure portal and Consumption logic app creation page.

  2. Finish creating your logic app resource.

    When you're done, your logic app is associated with your Log Analytics workspace. This step also automatically installs the Logic Apps Management solution in your workspace.

  3. After you run your workflow, view your workflow run status.

Install Logic Apps Management solution

If you turned on Log Analytics when you created your logic app resource, skip this section. You already have the Logic Apps Management solution installed in your Log Analytics workspace. Otherwise, continue with the following steps for an existing Consumption logic app:

  1. In the Azure portal search box, enter log analytics workspaces, and select Log Analytics workspaces from the results.

    Screenshot showing the Azure portal search box with log analytics workspaces selected.

  2. Under Log Analytics workspaces, select your workspace.

    Screenshot showing the Azure portal, the Log Analytics workspaces list, and a specific workspace selected.

  3. On the Overview pane, under Get started with Log Analytics > Configure monitoring solutions, select View solutions.

    Screenshot showing the Azure portal, the workspace's overview page, and View solutions selected.

  4. Under Overview, select Add, which adds a new solution to your workspace.

  5. After the Marketplace page opens, in the search box, enter logic apps management, and select Logic Apps Management.

    Screenshot showing the Azure portal, the Marketplace page search box with 'logic apps management' entered and 'Logic Apps Management' selected.

  6. On the Logic Apps Management tile, from the Create list, select Logic Apps Management.

    Screenshot showing the Azure portal, the Marketplace page, the 'Logic Apps Management' tile, with the Create list open, and Logic Apps Management (Preview) selected.

  7. On the Create Logic Apps Management (Preview) Solution pane, select the Log Analytics workspace where you want to install the solution. Select Review + create, review your information, and select Create.

    Screenshot showing the Azure portal, the Create Logic Apps Management (Preview) Solution page, and workspace information.

    After Azure deploys the solution to the Azure resource group that contains your Log Analytics workspace, the solution appears on your workspace summary pane under Overview.

    Screenshot showing the Azure portal, the workspace summary pane with Logic Apps Management solution.

Add a diagnostic setting

  1. In the Azure portal, open your Consumption logic app resource.

  2. On the logic app resource menu, under Monitoring, select Diagnostic settings. On the Diagnostic settings page, select Add diagnostic setting.

    Screenshot showing Azure portal, Consumption logic app resource menu with 'Diagnostic settings' selected and then 'Add diagnostic setting' selected.

  3. For Diagnostic setting name, provide the name that you want for the setting.

  4. Under Logs > Categories, select Workflow runtime diagnostic events. Under Metrics, select AllMetrics.

  5. Under Destination details, select one or more destinations, based on where you want to send the logs.

    Destination Directions
    Send to Log Analytics workspace Select the Azure subscription for your Log Analytics workspace and the workspace.
    Archive to a storage account Select the Azure subscription for your Azure storage account and the storage account. For more information, see Send diagnostic data to Azure Storage and Azure Event Hubs.
    Stream to an event hub Select the Azure subscription for your event hub namespace, event hub, and event hub policy name. For more information, see Send diagnostic data to Azure Storage and Azure Event Hubs and Azure Monitor partner integrations.
    Send to partner solution Select your Azure subscription and the destination. For more information, see Azure Native ISV Services overview.

    The following example selects a Log Analytics workspace as the destination:

    Screenshot showing Azure portal, Log Analytics workspace, and data to collect.

  6. To finish adding your diagnostic setting, select Save.

View workflow run status

After your workflow runs, you can view the data about those runs in your Log Analytics workspace.

  1. In the Azure portal, open your Log Analytics workspace.

  2. On your workspace menu, under Classic, select Workspace summary. On the Overview page, select Logic Apps Management.

    Note

    If the Logic Apps Management tile doesn't immediately show results after a run, try selecting Refresh or wait for a short time before trying again.

    Screenshot showing Azure portal, Log Analytics workspace with Consumption logic app workflow run status and count.

    The summary page shows workflows grouped by name or by execution status. The page also shows details about failures in the actions or triggers for the workflow runs.

    Screenshot showing status summary for Consumption logic app workflow runs.

  3. To view all the runs for a specific workflow or status, select the row for that workflow or status.

    This example shows all the runs for a specific workflow:

    Screenshot showing runs and status for a specific Consumption logic app workflow.

    For actions where you added tracked properties, you can search for the tracked properties using the column filter. To view the properties, in the Tracked Properties column, select View.

    Screenshot showing tracked properties for a specific Consumption logic app workflow.

  4. To filter your results, you can perform both client-side and server-side filtering.

    • Client-side filter: For each column, select the filters that you want, for example:

      Screenshot showing example client-side filter using column filters.

    • Server-side filter: To select a specific time window or to limit the number of runs that appear, use the scope control at the top of the page. By default, only 1,000 records appear at a time.

      Screenshot showing example server-side filter that changes the time window.

  5. To view all the actions and their details for a specific run, select the row for a logic app workflow run.

    The following example shows all the actions and triggers for a specific logic app workflow run:

    Screenshot showing all operations and details for a specific logic app workflow run.

Send diagnostic data to Azure Storage and Azure Event Hubs

Along with Azure Monitor Logs, you can send the collected data to other destinations, for example:

You can then get real-time monitoring by using telemetry and analytics from other services, such as Azure Stream Analytics and Power BI, for example:

Note

Retention periods apply only when you use a storage account.

Screenshot showing Azure portal, Consumption logic app resource, diagnostic setting with storage account and event hub options.

Include custom properties in telemetry

In your workflow, triggers and actions have the capability for you to add the following custom properties so that their values appear along with the emitted telemetry in your Log Analytics workspace.

Custom tracking ID

Most triggers have a Custom Tracking Id property where you can specify a tracking ID using an expression. You can use this expression to get data from the received message payload or to generate unique values, for example:

If you don't specify this custom tracking ID, Azure automatically generates this ID and correlates events across a workflow run, including any nested workflows that are called from the parent workflow. You can manually specify this ID in a trigger by passing a x-ms-client-tracking-id header with your custom ID value in the trigger request. You can use a Request trigger, HTTP trigger, or webhook-based trigger.

Tracked properties

Actions have a Tracked Properties section where you can specify a custom property name and value by entering an expression or hardcoded value to track specific inputs or outputs, for example:

Tracked properties can track only a single action's inputs and outputs, but you can use the correlation properties of events to correlate across actions in a workflow run.

Tracked properties can only reference the parameters, inputs, and outputs for its own trigger or action.

Tracked properties aren't allowed on a trigger or action that has secure inputs, secure outputs, or both. They're also not allowed to reference another trigger or action that has secure inputs, secure outputs, or both.

The following examples show where custom properties appear in your Log Analytics workspace:

  1. On your Log Analytics workspace menu, under Classic, select Workspace summary. On the Overview page, select Logic Apps Management.

  2. Select the row for the workflow that you want to review.

  3. On the Runs page, in the Logic App Runs table, find the Tracking ID column and the Tracked Properties column.

    Screenshot showing runs and status for a specific Consumption workflow.

  4. To search the tracked properties, use the column filter. To view the properties, select View.

    Screenshot showing example tracked properties for a specific Consumption  workflow.

Next steps