Monitoring and Diagnostics with Application Insights
Why Monitoring Matters for Production Logic Apps
Production Logic Apps handle critical business workflows — order processing, data synchronization, partner integrations. Without proper monitoring, failures go unnoticed, performance degrades silently, and troubleshooting becomes guesswork.
Application Insights provides:
- End-to-end tracing across workflow runs and actions
- Failure detection with root cause analysis
- Performance metrics to identify bottlenecks
- Alerting for proactive incident response
- Historical analysis via KQL queries
Step 1: Create an Application Insights Resource
- In the Azure Portal, search for Application Insights and select Create
- Configure the resource:
- Subscription: Select your subscription
- Resource Group: Use the same group as your Logic App
- Name:
appinsights-logicapps-prod - Region: Same region as your Logic App
- Workspace: Select or create a Log Analytics workspace
- Click Review + Create, then Create

Step 2: Connect Logic App to Application Insights
- Navigate to your Logic App in the Azure Portal
- Under Settings, select Application Insights
- Toggle Enable Application Insights to On
- Select the Application Insights resource created in Step 1
- Click Save

For Standard Logic Apps, you can also set this in host.json:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle.Workflows",
"version": "[1.*, 2.0.0)"
},
"extensions": {
"workflow": {
"settings": {
"Runtime.ApplicationInsightsInstrumentationKey": "<your-instrumentation-key>"
}
}
}
}
Step 3: View Workflow Traces in Application Insights
- Open your Application Insights resource
- Navigate to Transaction search
- Filter by Event types → Custom Events
- Look for events named
WorkflowRunStart,WorkflowRunEnd,WorkflowActionStart,WorkflowActionEnd - Click any event to see the end-to-end transaction with all actions

You can also use the Application Map to visualize dependencies between your Logic App and connected services.

Step 4: KQL Queries for Logic Apps
Open Logs in your Application Insights resource to run these queries.
Query 1: Failed Workflow Runs (Last 24 Hours)
requests
| where timestamp > ago(24h)
| where success == false
| where name has "workflow"
| summarize FailedRuns = count() by bin(timestamp, 1h), operation_Name
| order by timestamp desc
| render timechart
Query 2: Slow Workflow Runs (Duration > 30 seconds)
requests
| where timestamp > ago(7d)
| where duration > 30000
| where name has "workflow"
| project timestamp, operation_Name, duration, resultCode
| order by duration desc
| take 50
Query 3: Workflow Throughput by Hour
requests
| where timestamp > ago(24h)
| where name has "workflow"
| summarize TotalRuns = count(), FailedRuns = countif(success == false), AvgDuration = avg(duration) by bin(timestamp, 1h)
| extend SuccessRate = round((TotalRuns - FailedRuns) * 100.0 / TotalRuns, 2)
| order by timestamp desc
| render timechart
Query 4: Top Failing Actions
customEvents
| where timestamp > ago(7d)
| where name == "WorkflowActionCompleted"
| where customDimensions.status == "Failed"
| summarize FailureCount = count() by tostring(customDimensions.actionName), tostring(customDimensions.workflowName)
| order by FailureCount desc
| take 20

Step 5: Create Alert Rules
Alert Rule 1: Failure Rate Threshold
- In Application Insights, go to Alerts → Create alert rule
- Condition: Custom log search
requests | where timestamp > ago(5m) | where name has "workflow" | summarize Total = count(), Failed = countif(success == false) | extend FailureRate = Failed * 100.0 / Total | where FailureRate > 10 - Threshold: Greater than 0 results
- Evaluation frequency: Every 5 minutes
- Action Group: Select or create (email, SMS, webhook)
- Alert rule name:
Logic Apps - High Failure Rate

Alert Rule 2: Duration Anomaly
- Create another alert rule
- Condition: Custom log search
requests | where timestamp > ago(15m) | where name has "workflow" | summarize AvgDuration = avg(duration), P95Duration = percentile(duration, 95) | where P95Duration > 60000 - Threshold: Greater than 0 results
- Evaluation frequency: Every 15 minutes
- Action Group: Same or different group
- Alert rule name:
Logic Apps - Duration Anomaly

Step 6: Dashboard Creation in Azure Portal
- Navigate to Dashboard in the Azure Portal
- Click New dashboard → Blank dashboard
- Name it
Logic Apps Monitoring - Add tiles:
- Metrics tile: Workflow runs completed (success vs failure)
- Log Analytics tile: Pin your KQL throughput query
- Metrics tile: Action latency P95
- Alert summary tile: Active alerts count
- Arrange tiles and set time ranges
- Click Save and optionally Share with your team

Step 7: Diagnostic Settings (Send to Log Analytics)
- Navigate to your Logic App
- Under Monitoring, select Diagnostic settings
- Click Add diagnostic setting
- Configure:
- Name:
send-to-log-analytics - Logs: Check WorkflowRuntime and AllMetrics
- Destination: Select Send to Log Analytics workspace
- Workspace: Choose your workspace
- Name:
- Click Save

This enables long-term retention and cross-resource querying in Log Analytics.
Alerting Best Practices
| Practice | Recommendation |
|---|---|
| Alert fatigue | Set meaningful thresholds; avoid alerting on every single failure |
| Severity levels | Use Sev 0 for critical (complete outage), Sev 2 for warnings |
| Action groups | Route critical alerts to PagerDuty/phone; warnings to email/Teams |
| Suppression | Configure suppression windows during planned maintenance |
| Escalation | Set up multi-tier notification (email → SMS → phone call) |
| Documentation | Include runbook links in alert descriptions |
| Testing | Test alert rules with intentional failures before going live |
| Review cadence | Review and tune alert thresholds monthly |
Summary
You now have full observability over your Logic Apps:
- ✅ Application Insights connected for tracing
- ✅ KQL queries for failure analysis and performance monitoring
- ✅ Alert rules for proactive incident detection
- ✅ Dashboard for at-a-glance health overview
- ✅ Diagnostic settings for long-term log retention
Navigation
← Previous: Managed Identity Configuration | Next: Back to Tutorials →