Skip to main content

Azureblob Exporter

Status Available in: contrib Maintainers: @hgaol, @MovieStoreGuy Source: opentelemetry-collector-contrib

Supported Telemetry

Logs Metrics Traces

Overview

Configuration

The following settings are required:
  • url: Must be specified if auth type is not connection_string. If auth type is connection_string, itโ€™s optional or will be override by the auth.connection_string. Azure storage account endpoint. This setting might be replaced with endpoint for future. e.g. https://<account-name>.blob.core.windows.net/
  • auth (no default): Authentication method for exporter to ingest data.
    • type (no default): Authentication type for exporter. supported values are: connection_string, service_principal, system_managed_identity, user_managed_identity and workload_identity.
    • tenand_id: Tenand Id for the client, only needed when type is service_principal and workload_identity.
    • client_id: Client Id for the auth, only needed when type is service_principal, user_managed_identity and workload_identity.
    • client_secret: Secret for the client, only needed when type is service_principal.
    • connection_string: Connection string to the endpoint. Only needed for connection_string auth type. Once provided, itโ€™ll override the url parameter to the storage account.
    • federated_token_file: The path of the projected service account token file, only needed when type is workload_identity.
The following settings can be optionally configured and have default values:
  • container: container for metrics, logs and traces. A container organizes a set of blobs, similar to a directory in a file system. More details can refer this.
    • metrics (default metrics): container to store metrics. default value is metrics.
    • logs (default logs): container to store logs. default value is logs.
    • traces (default traces): container to store traces. default value is traces.
  • blob_name_format: the final blob name will be blob_name
    • template_enabled (default false): enables Go template parsing for blob name formats. If parsing fails, it will not throw an error but will log a warning and continue formatting the blob name using other rules.
    • metrics_format (default 2006/01/02/metrics_15_04_05.json): blob name format. The date format follows constants in Golang, refer here.
    • logs_format (default 2006/01/02/logs_15_04_05.json): blob name format.
    • traces_format (default 2006/01/02/traces_15_04_05.json): blob name format.
    • timezone (default ""): Timezone for blob name formatting. Local time is used if empty. Must be a valid IANA timezone identifier accepted by Golangโ€™s time.LoadLocation, such as UTC or America/New_York.
    • serial_num_enabled (default true): toggles whether a random serial number is appended to the blob name.
    • serial_num_range (default 10000): a range of random number to be appended after blob_name. e.g. blob_name_{serial_num}. the number will be in [0, serial_num_range).
    • serial_num_before_extension (default false): places the serial number before the file extension if there is one. e.g blob_name_{serial_num}.json instead of blob_name.json_{serial_num}
    • time_parser_enabled (default true): controls whether the exporter interprets the format string as a Go time layout. When false, values such as 2006 or 15_04_05 are treated as literal text.
    • time_parser_ranges (default nil): limits time formatting to specific parts of the blob name. When not set (nil), the entire blob name is time-formatted if time_parser_enabled is true. Provide a list of character ranges like ["0-10", "15-25"] to only apply time formatting within those positions. For example, if your blob name is prefix/2006/01/02/file.json and you set time_parser_ranges: ["7-17"], only the 2006/01/02 portion will be replaced with actual date values, while prefix/ and /file.json remain unchanged. This is helpful when your blob name contains patterns like 2006 that you want to keep as literal text.
  • format (default json): json or proto. which present otel json or otel protobuf format, the file extension will be json or pb.
  • encodings (default using encoding specified in format, which is json): if specified, uses the encoding extension to encode telemetry data. Overrides format.
    • logs (default nil): encoding component id.
    • metrics (default nil): encoding component id.
    • traces (default nil): encoding component id.
  • append_blob: configures append blob behavior. When enabled, telemetry data is appended to a single blob instead of creating new blobs. This can be useful for aggregating data or reducing the number of blobs created.
    • enabled (default false): determines whether to use append blob mode.
    • separator (default \n): string to insert between appended data blocks.
  • retry_on_failure
    • enabled (default = true)
    • initial_interval (default = 5s): Time to wait after the first failure before retrying; ignored if enabled is false
    • max_interval (default = 30s): Is the upper bound on backoff; ignored if enabled is false
    • max_elapsed_time (default = 120s): Is the maximum amount of time spent trying to send a batch; ignored if enabled is false

Blob Name Templates

When template_enabled is true, you can use Go templates in metrics_format, logs_format, and traces_format to create dynamic blob names based on telemetry data. The root object for the template is the telemetry data itself (pmetric.Metrics, plog.Logs, or ptrace.Traces). The following template functions are available:
FunctionDescriptionExample
getResourceMetricAttrGets a resource attribute from metrics data.{{ getResourceMetricAttr . 0 "service.name" }}
getResourceLogAttrGets a resource attribute from logs data.{{ getResourceLogAttr . 0 "service.name" }}
getResourceSpanAttrGets a resource attribute from traces data.{{ getResourceSpanAttr . 0 "service.name" }}
getScopeMetricAttrGets a scope attribute from metrics data.{{ getScopeMetricAttr . 0 0 "scope.name" }}
getScopeLogAttrGets a scope attribute from logs data.{{ getScopeLogAttr . 0 0 "scope.name" }}
getScopeSpanAttrGets a scope attribute from traces data.{{ getScopeSpanAttr . 0 0 "scope.name" }}
getMetricGets a metric object. You can chain to access its fields.{{ (getMetric . 0 0 0).Name }}
getLogRecordGets a log record object. You can chain to access its fields.{{ (getLogRecord . 0 0 0).TraceID }}
getSpanGets a span object. You can chain to access its fields.{{ (getSpan . 0 0 0).Name }}
An example configuration is provided as follows:
extensions:
  zpages:
    endpoint: localhost:55679
  text_encoding:
    encoding: utf8
    marshaling_separator: "\n"
    unmarshaling_separator: "\r?\n"

exporter:
  azure_blob/1:
    url: "https://<your-account>.blob.core.windows.net/"
    container:
      logs: "logs"
      metrics: "metrics"
      traces: "traces"
    blob_name_format:
      template_enabled: true
      metrics_format: `{{ getResourceMetricAttr . 0 "service.name" }}/2006/01/02/metrics.json`
      logs_format: `{{ getScopeLogAttr . 0 0 "scope.name" }}/2006/01/02/logs.json`
      traces_format: `{{ (getSpan . 0 0 0).Name }}/2006/01/02/traces.json`
      serial_num_enabled: true
      time_parser_enabled: true
    auth:
      type: "connection_string"
      connection_string: "DefaultEndpointsProtocol=https;AccountName=<your-acount>;AccountKey=<account-key>;EndpointSuffix=core.windows.net"
    encodings:
      logs: text_encoding
    append_blob:
      enabled: true
      separator: "\n"

Append Blob

When append_blob is enabled:
  • The exporter will create append blobs instead of block blobs
  • New data will be appended to existing blobs rather than creating new ones
  • The configured separator will be inserted between data blocks
  • If the blob doesnโ€™t exist, it will be created automatically

Configuration

Example Configuration

azure_blob/sp:
  url: "https://fakeaccount.blob.core.windows.net/"
  auth:
    type: "service_principal"
    tenant_id: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"
    client_id: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"
    client_secret: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"
  container:
    metrics: "test"
    logs: "test"
    traces: "test"
azure_blob/smi:
  url: "https://fakeaccount.blob.core.windows.net/"
  auth:
    type: "system_managed_identity"
  format: "proto"
  container:
    metrics: "test"
    logs: "test"
    traces: "test"
azure_blob/umi:
  url: "https://fakeaccount.blob.core.windows.net/"
  auth:
    type: "user_managed_identity"
    client_id: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"
  container:
    metrics: "test"
    logs: "test"
    traces: "test"
azure_blob/conn-string:
  # for connection string auth, no need to specify url, because it's already included in connection string
  auth:
    type: "connection_string"
    connection_string: "DefaultEndpointsProtocol=https;AccountName=fakeaccount;AccountKey=ZmFrZWtleQ==;EndpointSuffix=core.windows.net"
  container:
    metrics: "test"
    logs: "test"
    traces: "test"
azure_blob/wif:
  url: "https://fakeaccount.blob.core.windows.net/"
  auth:
    type: "workload_identity"
    client_id: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"
    tenant_id: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"
    federated_token_file: "/path/to/federated/token/file"
  container:
    metrics: "test"
    logs: "test"
    traces: "test"
azure_blob/err1:
  auth:
    type: "system_managed_identity"
azure_blob/err2:
  auth:
    type: "connection_string"
azure_blob/err3:
  url: "https://fakeaccount.blob.core.windows.net/"
  auth:
    type: "service_principal"
    client_id: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"
    client_secret: "<client secret>"
azure_blob/err4:
  url: "https://fakeaccount.blob.core.windows.net/"
  auth:
    type: "user_managed_identity"
azure_blob/err5:
  url: "https://fakeaccount.blob.core.windows.net/"
  auth:
    type: "system_managed_identity"
  format: "custom"
azure_blob/err6:
  url: "https://fakeaccount.blob.core.windows.net/"
  auth:
    type: "workload_identity"
    client_id: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"
    tenant_id: "e4b5a5f0-3d6a-4b1c-9e2f-7c8a1b8f2c3d"

Last generated: 2026-04-13