Skip to main content

Azureeventhub Receiver

Status Available in: contrib Maintainers: @atoulme, @cparkins, @dyl10s Source: opentelemetry-collector-contrib

Supported Telemetry

Logs Metrics Traces

Overview

Overview

Azure resources and services can be configured to send their telemetry to an Azure Event Hub. The Azure Event Hub receiver pulls telemetry from an Azure Event Hub, transforms them, and pushes them through the collector pipeline.

Read further

Configuration

Connection Settings

Either connection or auth must be specified.
FieldTypeRequiredDefaultDescription
connectionstringYes*Connection string from the Azure portal. Ignored if auth is set.
authstringYes*ID of an authentication extension (AAD, managed identity, or service principal).
event_hub.namestring**Event Hub name. Required when using auth.
event_hub.namespacestring**Fully qualified namespace (e.g., namespace.servicebus.windows.net). Required when using auth.
* One of connection or auth is required.
** Required when using auth.

Consumer Settings

FieldTypeRequiredDefaultDescription
groupstringNo$DefaultConsumer group to read from.
partitionstringNo""Specific partition to watch. If empty, watches all partitions.
offsetstringNo""Starting offset. Only applicable when partition is set.
storagestringNoID of a storage extension for checkpoint persistence.

Distributed Consumption Settings

When blob_checkpoint_store is set, the receiver uses the Azure SDK Processor to coordinate partition ownership across multiple collector instances via Azure Blob Storage. This is mutually exclusive with partition, offset, and storage.
FieldTypeRequiredDefaultDescription
blob_checkpoint_store.connectionstring*Azure Blob Storage connection string. Required when not using auth.
blob_checkpoint_store.storage_account_urlstring*Blob service URL (e.g., https://myaccount.blob.core.windows.net). Required when using auth.
blob_checkpoint_store.container_namestringYesBlob container for checkpoint data. Must already exist before starting the collector.
* One of connection or storage_account_url is required.

Polling Settings

FieldTypeRequiredDefaultDescription
max_poll_eventsintNo100Maximum events to retrieve per poll.
poll_rateintNo5Maximum seconds to wait before returning fewer than max_poll_events.

Data Transformation Settings

FieldTypeRequiredDefaultDescription
formatstringNoazureMessage format: azure, raw, or "". See Format section.
apply_semantic_conventionsboolNofalseTranslate Azure Resource Logs using OpenTelemetry semantic convention attribute names.
time_formats.logs[]stringNoCustom time formats for logs. Uses Go time layout. Falls back to ISO8601.
time_formats.metrics[]stringNoCustom time formats for metrics.
time_formats.traces[]stringNoCustom time formats for traces.
metric_aggregationstringNoSet to average to aggregate datapoints as sum/count. By default, creates separate metrics with suffixes (_TOTAL, _MIN, etc.).

Example Configuration

The simplest configuration uses a connection string from the Azure portal:
receivers:
  azure_event_hub:
    connection: Endpoint=sb://<namespace>.servicebus.windows.net/;SharedAccessKeyName=<key-name>;SharedAccessKey=<key>;EntityPath=<hub-name>
    group: $Default  # optional, defaults to $Default
The full list of settings exposed for this receiver are documented above with detailed sample configurations in testdata/config.yaml.

Advanced Configuration

Azure Auth Extension with Service Principal

receivers:
  azure_event_hub:
    event_hub:
      name: hubName
      namespace: namespace.servicebus.windows.net
    auth: azure_auth

extensions:
  azure_auth:
    service_principal:
      client_id: ${env:AZURE_CLIENT_ID}
      client_secret: ${env:AZURE_CLIENT_SECRET}
      tenant_id: ${env:AZURE_TENANT_ID}

Checkpoint Persistence with Storage Extension

This component can persist its state (checkpoint offsets) using the storage extension. This is strongly recommended for production deployments to prevent message reprocessing after collector restarts. Without a storage extension configured, the receiver will start from the latest offset on each restart, potentially missing messages that arrived while the collector was down.
receivers:
  azure_event_hub:
    connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
    storage: file_storage

extensions:
  file_storage:
    directory: /var/lib/otelcol/eventhub

Distributed Consumption with Blob Checkpoint Store

When blob_checkpoint_store is configured, the receiver automatically:
  • Coordinates partition ownership across collector instances via blob leases
  • Checkpoints progress to Azure Blob Storage
  • Rebalances partitions when instances are added or removed
Prerequisites:
  • The blob container must already exist before starting the collector
  • All collector instances must use the same consumer group and container

receivers:
  azure_event_hub:
    connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
    blob_checkpoint_store:
      connection: DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;EndpointSuffix=core.windows.net
      container_name: eventhub-checkpoints
# With auth extension
receivers:
  azure_event_hub:
    event_hub:
      name: hubName
      namespace: namespace.servicebus.windows.net
    auth: azureauth
    blob_checkpoint_store:
      storage_account_url: https://myaccount.blob.core.windows.net
      container_name: eventhub-checkpoints

Custom Time Formats and Partitioning

receivers:
  azure_event_hub:
    connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
    partition: "0"
    group: my-consumer-group
    offset: "1234-5566"
    format: "azure"
    time_formats:
      logs: ["01/02/2006 15:04:05", "2006-01-02 15:04:05"]
      metrics: ["01/02/2006 15:04:05"]

Known Limitations

Before using this receiver, be aware of the following limitations:

Checkpoint Persistence

  • Without a configured storage extension, checkpoint state is stored only in memory. If the collector restarts, the receiver will resume from the latest offset, potentially missing messages or reprocessing already-consumed messages.

Format

raw

The “raw” format maps the AMQP properties and data into the attributes and body of an OpenTelemetry LogRecord, respectively. The body is represented as a raw byte array.
[!WARNING] This format is only supported for Logs. Using raw format with Metrics or Traces pipelines will result in an error.

azure

Logs

The “azure” format extracts the Azure log records from the AMQP message data, parses them, and maps the fields to OpenTelemetry attributes. The table below summarizes the mapping between the Azure common log format and the OpenTelemetry attributes.
AzureOpenTelemetry
callerIpAddress (optional)network.peer.address (attribute)
correlationId (optional)azure.correlation.id (attribute)
category (optional)azure.category (attribute)
durationMs (optional)azure.duration (attribute)
Level (optional)severity_number, severity_text (field)
location (optional)cloud.region (attribute)
cloud.provider (attribute)
operationName (required)azure.operation.name (attribute)
operationVersion (optional)azure.operation.version (attribute)
properties (optional)azure.properties (attribute, nested)
resourceId (required)azure.resource.id (resource attribute)
resultDescription (optional)azure.result.description (attribute)
resultSignature (optional)azure.result.signature (attribute)
resultType (optional)azure.result.type (attribute)
tenantId (required, tenant logs)azure.tenant.id (attribute)
time or timeStamp (required)time_unix_nano (time takes precedence)
identity (optional)azure.identity (attribute, nested)
Notes:
  • JSON does not distinguish between fixed and floating point numbers. All JSON numbers are encoded as doubles.

Metrics

For Metrics the Azure Metric Records are an array of “records” with the following fields, by type of metric. From this data a Metric of type Gauge is created with a Data Points that represents the values for the Metric including: Total, Minimum, Maximum, Average and Count.
Platform metric (from Azure resources)
AzureOpen Telemetry
timetime_unix_nano (field)
resourceIdazure.resource.id (resource attribute)
metricName
timeGrainstart_time_unix_nano (field)
totalmapped to datapoint metricName + “_TOTAL”
countmapped to datapoint metricName + “_COUNT”
minimummapped to datapoint metricName + “_MINIMUM”
maximummapped to datapoint metricName + “_MAXIMUM”
averagemapped to datapoint metricName + “_AVERAGE”
Application metrics (from Application Insights)
See: https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/appmetrics
AzureOpen Telemetry
timetime_unix_nano (field)
resourceIdazure.resource.id (resource attribute)
Name(metric name)
AppRoleInstanceservice.instance.id (resource attribute)
AppRoleNameservice.name (resource attribute)
AppVersionservice.version (resource attribute)
SDKVersiontelemetry.sdk.version (resource attribute)
ClientCountryOrRegioncloud.region (resource attribute)
ClientOSos.name (resource attribute)
Properties (key/value map)mapped to resource attributes
Summapped to datapoint metricName + “_TOTAL”
ItemCountmapped to datapoint metricName + “_COUNT”
Minmapped to datapoint metricName + “_MINIMUM”
Maxmapped to datapoint metricName + “_MAXIMUM”

Traces

Traces based on Azure Application Insights array of records from AppRequests & AppDependencies with the following fields.
AzureOpen Telemetry
Timestart_time(time_unix_nano(time))
end_time(start_time + time_unix_nano(durationMs))
Namespan.name
OperationIdtrace.id
ParentIdspan.parentId
Idspan.id
AppRoleNameservice.name

Configuration

Example Configuration

azure_event_hub:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName

azure_event_hub/missing_connection:

azure_event_hub/invalid_connection_string:
  connection: invalid

azure_event_hub/invalid_format:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
  format: invalid

azure_event_hub/offset_without_partition:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
  offset: "1234-5566"

azure_event_hub/offset_with_partition:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
  partition: foo
  offset: "1234-5566"

azure_event_hub/auth:
  event_hub:
    name: hubName
    namespace: namespace.servicebus.windows.net
  auth: azureauth

azure_event_hub/auth_missing_event_hub_name:
  auth: azureauth
  event_hub:
    namespace: ns

azure_event_hub/auth_missing_namespace:
  auth: azureauth
  event_hub:
    name: hub

azure_event_hub/blob_checkpoint_store:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
  blob_checkpoint_store:
    connection: DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;EndpointSuffix=core.windows.net
    container_name: eventhub-checkpoints

azure_event_hub/blob_checkpoint_store_auth:
  event_hub:
    name: hubName
    namespace: namespace.servicebus.windows.net
  auth: azureauth
  blob_checkpoint_store:
    storage_account_url: https://myaccount.blob.core.windows.net
    container_name: eventhub-checkpoints

azure_event_hub/blob_checkpoint_store_missing_container:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
  blob_checkpoint_store:
    connection: DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;EndpointSuffix=core.windows.net

azure_event_hub/blob_checkpoint_store_missing_connection:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
  blob_checkpoint_store:
    container_name: eventhub-checkpoints

azure_event_hub/blob_checkpoint_store_auth_missing_url:
  event_hub:
    name: hubName
    namespace: namespace.servicebus.windows.net
  auth: azureauth
  blob_checkpoint_store:
    container_name: eventhub-checkpoints

azure_event_hub/blob_checkpoint_store_with_partition:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
  partition: "0"
  blob_checkpoint_store:
    connection: DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;EndpointSuffix=core.windows.net
    container_name: eventhub-checkpoints

azure_event_hub/blob_checkpoint_store_with_storage:
  connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
  storage: file_storage
  blob_checkpoint_store:
    connection: DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;EndpointSuffix=core.windows.net
    container_name: eventhub-checkpoints

Last generated: 2026-04-13