Azure Monitor
Overview
This topic explains how to stream Azure Monitor logs and metrics from your Azure subscription to LaunchDarkly’s observability features. This integration allows you to monitor your Azure infrastructure alongside your feature flag data for unified observability.
The integration uses Azure Event Hubs and a serverless Azure Function to forward diagnostic data to LaunchDarkly. An Azure Resource Manager (ARM) template automates the entire setup:
- Azure Diagnostic Settings stream logs and metrics from your resources to an Event Hub.
- An Azure Function triggers on each batch of events, separates logs from metrics, and forwards both as OTLP JSON to LaunchDarkly’s OpenTelemetry collector.
Prerequisites
To use the Azure Monitor integration, you need:
- A LaunchDarkly client-side ID for your target environment
- An Azure subscription with permissions to create:
- Event Hub namespaces
- Function Apps
- Storage accounts
To find and copy your LaunchDarkly client-side ID, read View or copy keys and credentials.
Deploy the ARM template
The ARM template creates all required infrastructure and deploys the forwarding function automatically.
To deploy the ARM template:
- Open the Azure Portal.
- Search for Deploy a custom template and select it.
- Click Build your own template in the editor.
- Clear the default contents, then paste the ARM template below into the editor.
- Click Save.
- Select a Resource group or create a new one.
- Enter your LaunchDarkly environment’s client-side ID into the LaunchDarkly Client Side Id parameter.
- Click Review + create, then click Create.
The deployment takes 2-3 minutes. After it completes, the Event Hub and forwarding function are ready to receive data. Copy and save the Event Hub namespace name from the deployment outputs to use when you configure Diagnostic Settings.
ARM template
Expand ARM template
The template includes an inline Azure Function that forwards data to LaunchDarkly. To view a readable version of the function source code, read Function code reference below.
Configure Azure Diagnostic Settings
After deploying the integration, configure your Azure resources to stream diagnostic data to the Event Hub.
To configure Diagnostic Settings:
- Open the Azure Portal.
- Navigate to the Azure resource you want to monitor, such as an App Service, Virtual Machine, or SQL Database.
- Click Diagnostic settings under Monitoring in the left menu.
- Click Add diagnostic setting.
- Enter a name, such as
launchdarkly-observability. - Under Logs, select the log categories you want to forward.
- Under Metrics, check AllMetrics.
- Under Destination details, check Stream to an event hub.
- Select the Event Hub namespace created by the ARM template.
- Select
launchdarkly-diagnosticsas the Event Hub name. - Select
RootManageSharedAccessKeyas the Event Hub policy name. - Click Save.
Repeat these steps for each Azure resource you want to monitor.
Configuring diagnostics at scale
For large environments, use Azure Policy to automatically deploy diagnostic settings to resources as they are created. To learn more, read Create diagnostic settings at scale using Azure Policy in the Microsoft documentation.
What the template creates
The ARM template creates the following Azure resources:
- Event Hub Namespace and Event Hub: Receives diagnostic data streamed from your Azure resources
- Function App with forwarding function (Node.js 22): Serverless function that triggers on Event Hub messages, separates logs from metrics, and forwards both as OTLP JSON to LaunchDarkly’s OpenTelemetry collector, deployed automatically by the template
- App Service Plan (Consumption): Serverless hosting for the Function App with pay-per-execution pricing
- Storage Account: Required for Function App state and trigger checkpointing
All resource names are auto-generated using a unique suffix derived from your resource group ID.
Customizing the compute resources
The template uses a Consumption (serverless) plan for pay-per-execution pricing, which is sufficient for most workloads. You can modify the template to use a different hosting plan based on your requirements. To learn more, read Azure Functions hosting options in the Microsoft documentation.
View data in LaunchDarkly observability dashboards
After deployment, data appears in the LaunchDarkly observability dashboard within 1-2 minutes of configuring Diagnostic Settings.
To view your data:
- Navigate to Observability in LaunchDarkly.
- Select the environment you configured.
- Navigate to the Logs tab to view Azure diagnostic logs such as HTTP request logs, console output, and audit events.
- Navigate to the Metrics tab to view Azure platform metrics such as CPU percentage, memory usage, and request counts.
- Use the search and filter controls to query your Azure data.
Log records include attributes such as azure.resourceId, azure.category, and azure.operationName for filtering. Metric records use names following the pattern azure.<metricName>, for example azure.CpuPercentage or azure.Http2xx, and are sent as OTLP histograms with sum, count, min, and max values. Metrics include attributes such as azure.resource.id, azure.namespace, and dimension attributes such as azure.dimension.ActivityName.
All records include a service.name attribute set to azure by default. To distinguish data from multiple Azure subscriptions or environments, change the LAUNCHDARKLY_SERVICE application setting in the Function App to a unique value such as azure-production or azure-staging.
Control data volume (optional)
By default, only those Azure resources that use Diagnostic Settings send data to LaunchDarkly. To control data volume, enable Diagnostic Settings only on the resources you want to monitor.
You can also filter within Diagnostic Settings by selecting specific log categories instead of all categories. For example, you might select only AppServiceHTTPLogs and AppServiceConsoleLogs for an App Service, omitting audit and platform logs.
Function code reference
The ARM template deploys a Node.js Azure Function that parses Azure Monitor diagnostic records, separates them into logs and metrics, and forwards both as OTLP JSON to LaunchDarkly’s OpenTelemetry collector at /v1/logs and /v1/metrics. Expand this section to view the function source code.
Expand function source code
Troubleshooting
If data does not appear in LaunchDarkly after configuring Diagnostic Settings:
-
Verify the Event Hub is receiving data. Open the Event Hub namespace in the Azure Portal and check the Messages chart under Overview. If no messages appear, check your Diagnostic Settings configuration.
-
Verify the Function App is running. Open the Function App in the Azure Portal and navigate to Functions > ForwardToLaunchDarkly > Monitor for invocation logs. If invocations fail, check the error messages.
-
Verify the client-side ID. Confirm that the
LAUNCHDARKLY_CLIENT_SIDE_IDapplication setting in the Function App matches your LaunchDarkly environment’s client-side ID. -
Check Function App logs. Open the Function App in the Azure Portal and navigate to Log stream under Monitoring to view real-time logs from the function.