Monitor status, set up diagnostics logging, and turn on alerts for Azure Logic Apps

After you create and run a logic app, you can check its runs history, trigger history, status, and performance. For real-time event monitoring and richer debugging, set up diagnostics logging for your logic app. That way, you can find and view events, like trigger events, run events, and action events. You can also use this diagnostics data with other services, like Azure Storage and Azure Event Hubs.

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." You can also set up monitoring, tracking, and logging programmatically by using Azure Diagnostics event settings and properties.

View runs and trigger history for your logic app

  1. To find your logic app in the Azure portal, on the main Azure menu, choose More services. In the search box, find "logic apps", and choose Logic apps.

    Find your logic app

    The Azure portal shows all the logic apps that are associated with your Azure subscription.

  2. Select your logic app, then choose Overview.

    The Azure portal shows the runs history and trigger history for your logic app. For example:

    Logic app runs history and trigger history

    • Runs history shows all the runs for your logic app.
    • Trigger History shows all the trigger activity for your logic app.

    For status descriptions, see Troubleshoot your logic app.

    Tip

    If you don't find the data that you expect, on the toolbar, choose Refresh.

  3. To view the steps from a specific run, under Runs history, select that run.

    The monitor view shows each step in that run. For example:

    Actions for a specific run

  4. To get more details about the run, choose Run Details. This information summarizes the steps, status, inputs, and outputs for the run.

    Choose "Run Details"

    For example, you can get the run's Correlation ID, which you might need when you use the REST API for Logic Apps.

  5. To get details about a specific step, choose that step. You can now review details like inputs, outputs, and any errors that happened for that step. For example:

    Step details

    Note

    All runtime details and events are encrypted within the Logic Apps service. They are decrypted only when a user requests to view that data. You can also control access to these events with Azure Role-Based Access Control (RBAC).

  6. To get details about a specific trigger event, go back to the Overview pane. Under Trigger history, select the trigger event. You can now review details like inputs and outputs, for example:

    Trigger event output details

Turn on diagnostics logging for your logic app

For richer debugging with runtime details and events, you can set up diagnostics logging with Azure Log Analytics. Log Analytics is a service in Operations Management Suite (OMS) that monitors your cloud and on-premises environments to help you maintain their availability and performance.

Before you start, you need to have an OMS workspace. Learn how to create an OMS workspace.

  1. In the Azure portal, find and select your logic app.

  2. On the logic app blade menu, under Monitoring, choose Diagnostics > Diagnostic Settings.

    Go to Monitoring, Diagnostics, Diagnostic Settings

  3. Under Diagnostics settings, choose On.

    Turn on diagnostic logs

  4. Now select the OMS workspace and event category for logging as shown:

    1. Select Send to Log Analytics.
    2. Under Log Analytics, choose Configure.
    3. Under OMS Workspaces, select the OMS workspace to use for logging.
    4. Under Log, select the WorkflowRuntime category.
    5. Choose the metric interval.
    6. When you're done, choose Save.

    Select OMS workspace and data for logging

Now, you can find events and other data for trigger events, run events, and action events.

Find events and data for your logic app

To find and view events in your logic app, like trigger events, run events, and action events, follow these steps.

  1. In the Azure portal, choose More Services. Search for "log analytics", then choose Log Analytics as shown here:

    Choose "Log Analytics"

  2. Under Log Analytics, find and select your OMS workspace.

    Select your OMS workspace

  3. Under Management, choose OMS Portal.

    Choose "OMS Portal"

  4. On your OMS home page, choose Log Search.

    On your OMS home page, choose "Log Search"

    -or-

    On the OMS menu, choose "Log Search"

  5. In the search box, specify a field that you want to find, and press Enter. When you start typing, OMS shows you possible matches and operations that you can use.

    For example, to find the top 10 events that happened, enter and select this search query: Category=WorkflowRuntime |top 10

    Enter search string

    Learn more about how to find data in Log Analytics.

  6. On the results page, in the left bar, choose the timeframe that you want to view. To refine your query by adding a filter, choose +Add.

    Choose timeframe for query results

  7. Under Add Filters, enter the filter name so you can find the filter you want. Select the filter, and choose +Add.

    This example uses the word "status" to find failed events under AzureDiagnostics. Here the filter for status_s is already selected.

    Select filter

  8. In the left bar, select the filter value that you want to use, and choose Apply.

    Select filter value, choose "Apply"

  9. Now return to the query that you're building. Your query is updated with your selected filter and value. Your previous results are now filtered too.

    Return to your query with filtered results

  10. To save your query for future use, choose Save. Learn how to save your query.

Extend how and where you use diagnostic data with other services

Along with Azure Log Analytics, you can extend how you use your logic app's diagnostic data with other Azure services, for example:

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

Based on the options that you want set up, make sure that you first create an Azure storage account or create an Azure event hub. Then select the options for where you want to send diagnostic data:

Send data to Azure storage account or event hub

Note

Retention periods apply only when you choose to use a storage account.

Set up alerts for your logic app

To monitor specific metrics or exceeded thresholds for your logic app, set up alerts in Azure. Learn about metrics in Azure.

To set up alerts without Azure Log Analytics, follow these steps. For more advanced alerts criteria and actions, set up Log Analytics too.

  1. On the logic app blade menu, under Monitoring, choose Diagnostics > Alert rules > Add alert as shown here:

    Add an alert for your logic app

  2. On the Add an alert rule blade, create your alert as shown:

    1. Under Resource, select your logic app, if not already selected.
    2. Give a name and description for your alert.
    3. Select a Metric or event that you want to track.
    4. Select a Condition, specify a Threshold for the metric, and select the Period for monitoring this metric.
    5. Select whether to send mail for the alert.
    6. Specify any other email addresses for sending the alert. You can also specify a webhook URL where you want to send the alert.

    For example, this rule sends an alert when five or more runs fail in an hour:

    Create metric alert rule

Tip

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:

Azure Diagnostics event settings and details

Each diagnostic event has details about your logic app and that event, for example, the status, start time, end time, and so on. To programmatically set up monitoring, tracking, and logging, ou can use these details with the REST API for Azure Logic Apps and the REST API for Azure Diagnostics.

For example, the ActionCompleted event has the clientTrackingId and trackedProperties properties that you can use for tracking and monitoring:

{
    "time": "2016-07-09T17:09:54.4773148Z",
    "workflowId": "/SUBSCRIPTIONS/<subscription-ID>/RESOURCEGROUPS/MYRESOURCEGROUP/PROVIDERS/MICROSOFT.LOGIC/WORKFLOWS/MYLOGICAPP",
    "resourceId": "/SUBSCRIPTIONS/<subscription-ID>/RESOURCEGROUPS/MYRESOURCEGROUP/PROVIDERS/MICROSOFT.LOGIC/WORKFLOWS/MYLOGICAPP/RUNS/08587361146922712057/ACTIONS/HTTP",
    "category": "WorkflowRuntime",
    "level": "Information",
    "operationName": "Microsoft.Logic/workflows/workflowActionCompleted",
    "properties": {
        "$schema": "2016-06-01",
        "startTime": "2016-07-09T17:09:53.4336305Z",
        "endTime": "2016-07-09T17:09:53.5430281Z",
        "status": "Succeeded",
        "code": "OK",
        "resource": {
            "subscriptionId": "<subscription-ID>",
            "resourceGroupName": "MyResourceGroup",
            "workflowId": "cff00d5458f944d5a766f2f9ad142553",
            "workflowName": "MyLogicApp",
            "runId": "08587361146922712057",
            "location": "westus",
            "actionName": "Http"
        },
        "correlation": {
            "actionTrackingId": "e1931543-906d-4d1d-baed-dee72ddf1047",
            "clientTrackingId": "<my-custom-tracking-ID>"
        },
        "trackedProperties": {
            "myTrackedProperty": "<value>"
        }
    }
}
  • clientTrackingId: If not provided, Azure automatically generates this ID and correlates events across a logic app run, including any nested workflows that are called from the logic app. You can manually specify this ID from 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 trigger.

  • trackedProperties: To track inputs or outputs in diagnostics data, you can add tracked properties to actions in your logic app's JSON definition. 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 run.

    To track one or more properties, add the trackedProperties section and the properties you want to the action definition. For example, suppose you want to track data like an "order ID" in your telemetry:

    "myAction": {
      "type": "http",
      "inputs": {
          "uri": "http://uri",
          "headers": {
              "Content-Type": "application/json"
          },
          "body": "@triggerBody()"
      },
      "trackedProperties": {
          "myActionHTTPStatusCode": "@action()['outputs']['statusCode']",
          "myActionHTTPValue": "@action()['outputs']['body']['<content>']",
          "transactionId": "@action()['inputs']['body']['<content>']"
      }
    }
    

Next steps