Hello @Ritu Raj
Thank you for confirming & providing additional info in the comments above. As I understand it, you have a workflow in Logic Apps comprising of multiple critical Steps which may be represented as Scopes and/or Actions (referred to as Steps below); and as your workflow runs, your goal is to capture these critical steps with your custom tracker data and send the data to your Application Insights.
Upon review, I found that our official guidance & documentation on this exact question is quite scarce at the time of this writing and there isn't much available (besides the ones referenced/linked later in my answer here) on the internet - perhaps, partly due to the "newness" of the Standard tier offering of Logic Apps.
Similar to how it was done with the Consumption tier (which required Log Analytics workspace & constructing of log queries for viewing), the specific feature designed for this type of use-case is Tracked Properties which is a custom data piece that you can correlate across all or some Steps; or bind to a specific Step, and emit to App Insights. In contrast to the Log Analytics approach, Logic Apps Standard provides built-in integration and support for Application Insights which enables monitoring experience a lot smoother & spot-on with richer application-level monitoring features.
For your particular use-case for defining Tracked Properties, whether the critical step is defined as Scope or Action in your workflow, you may navigate to the Settings tab of each Action, and provide key/value pair custom data. And once that is done, for querying & viewing the data in App Insights, you would need to use the traces
table in App Insights accompanied by WorkflowActionEnd event data. The key steps are as follows:
- In your locally running workflow, define custom trace data as Tracked Properties for critical steps of your workflow.
- In the
hosts.json
file, define log level, for example: {
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle.Workflows",
"version": "[1.*, 2.0.0)"
},
"logging":{
"logLevel": {
"Host.Triggers.Workflows":"Trace"
}
}
} - Save & Publish your Logic Apps Standard workflow to Azure - this should create accompanying App Insights resource and automatically integrate.
- Run your workflow multiple times to produce event data in App Insights & wait a couple of mins so you can test
- Head over to App Insights resource, navigate to the Logs under Monitoring
- Run the following query using the
traces
table,"Host.Triggers.Workflows"
category as well as the"WorkflowActionEnd"
event: traces
| where customDimensions["Category"] == "Host.Triggers.Workflows"
| where customDimensions["EventName"] == "WorkflowActionEnd" - From the result, locate the record that matches the specific Action you have defined the Tracked Properties as a critical step of your workflow.
- Expand the record & navigate:
customDimensions
->prop_properties
->trackedProperties
- Your custom key/value data pair should be there.
Steps 6-9 above are for testing in simplicity. For a real use-case, you might construct your own, more accurate query that suits your needs.
For more information & broader context, please review the following resources:
- Monitoring Logic Apps with Application Insights video by Paco de la Cruz
- 2 parts blog posts, Azure Logic Apps Running Anywhere – Monitor with Application Insights, by Hamza Assyad:
I hope the info put together above is helpful and makes it a bit easier for you & others visiting here to get the tracing working according to your needs.