> For the complete documentation index, see [llms.txt](https://docs.fluentbit.io/manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fluentbit.io/manual/4.2/data-pipeline/outputs/opentelemetry.md).

# OpenTelemetry

{% hint style="info" %}
**Supported event types:** `logs` `metrics` `traces` `profiles`
{% endhint %}

The OpenTelemetry output plugin lets you send logs, metrics, traces, and profiles from Fluent Bit to an OpenTelemetry Protocol (OTLP) endpoint. It supports OTLP/HTTP and OTLP/gRPC.

## Transport

By default, the plugin uses OTLP/HTTP with Protocol Buffers over HTTP/1.1. Set `grpc` to `on` to use OTLP/gRPC over HTTP/2 instead. Enabling gRPC automatically enables HTTP/2, including HTTP/2 without TLS (h2c), so you don't also need to set `http2`.

The transport setting applies to every supported signal routed to this output. The plugin selects the corresponding URI for each signal:

| Signal   | OTLP/HTTP default         | OTLP/gRPC default                                                               |
| -------- | ------------------------- | ------------------------------------------------------------------------------- |
| Logs     | `/v1/logs`                | `/opentelemetry.proto.collector.logs.v1.LogsService/Export`                     |
| Metrics  | `/v1/metrics`             | `/opentelemetry.proto.collector.metrics.v1.MetricsService/Export`               |
| Traces   | `/v1/traces`              | `/opentelemetry.proto.collector.trace.v1.TraceService/Export`                   |
| Profiles | `/v1development/profiles` | `/opentelemetry.proto.collector.profiles.v1experimental.ProfilesService/Export` |

Set `host` and `port` separately. For example, the standard OpenTelemetry Collector ports are `4318` for OTLP/HTTP and `4317` for OTLP/gRPC. Turn on `tls` when the endpoint requires a secure connection.

{% hint style="info" %}
`http2` controls the HTTP protocol version independently of the OTLP transport. Setting `http2` to `on` without setting `grpc` to `on` sends OTLP/HTTP over HTTP/2; it doesn't enable gRPC.
{% endhint %}

For example, this output sends every supported signal to an OpenTelemetry Collector using plain text OTLP/gRPC on its standard port:

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
pipeline:
  outputs:
    - name: opentelemetry
      match: "*"
      host: otel-collector
      port: 4317
      grpc: on
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```
[OUTPUT]
  Name   opentelemetry
  Match  *
  Host   otel-collector
  Port   4317
  Grpc   On
```

{% endtab %}
{% endtabs %}

## Configuration parameters

| Key                                       | Description                                                                                                                                                                                               | Default                                                                         |
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `add_label`                               | Adds a custom label to the metrics use format: `add_label name value`.                                                                                                                                    | *none*                                                                          |
| `alias`                                   | Sets an alias, use for multiple instances of the same output plugin.                                                                                                                                      | *none*                                                                          |
| `aws_auth`                                | Enable AWS SigV4 authentication.                                                                                                                                                                          | `false`                                                                         |
| `aws_external_id`                         | Specify an external ID for the STS API, can be used with the `aws_role_arn` parameter.                                                                                                                    | *none*                                                                          |
| `aws_profile`                             | AWS Profile name. AWS Profiles can be configured with AWS CLI.                                                                                                                                            | *none*                                                                          |
| `aws_region`                              | AWS region of your service.                                                                                                                                                                               | *none*                                                                          |
| `aws_role_arn`                            | ARN of an IAM role to assume (for example, for cross-account access).                                                                                                                                     | *none*                                                                          |
| `aws_service`                             | AWS destination service code, used by SigV4 authentication.                                                                                                                                               | `logs`                                                                          |
| `aws_sts_endpoint`                        | Custom endpoint for the AWS STS API, used with the `aws_role_arn` option.                                                                                                                                 | *none*                                                                          |
| `batch_size`                              | Set the maximum number of log records to be flushed at a time.                                                                                                                                            | `1000`                                                                          |
| `compress`                                | Set the OTLP/HTTP payload compression mechanism. Available options are `gzip` and `zstd`.                                                                                                                 | *none*                                                                          |
| `grpc`                                    | Use OTLP/gRPC over HTTP/2. Accepted values are `on` and `off`. Enabling this option also enables HTTP/2.                                                                                                  | `off`                                                                           |
| `grpc_logs_uri`                           | Set the gRPC method path for log exports.                                                                                                                                                                 | `/opentelemetry.proto.collector.logs.v1.LogsService/Export`                     |
| `grpc_metrics_uri`                        | Set the gRPC method path for metric exports.                                                                                                                                                              | `/opentelemetry.proto.collector.metrics.v1.MetricsService/Export`               |
| `grpc_profiles_uri`                       | Set the gRPC method path for profile exports.                                                                                                                                                             | `/opentelemetry.proto.collector.profiles.v1experimental.ProfilesService/Export` |
| `grpc_traces_uri`                         | Set the gRPC method path for trace exports.                                                                                                                                                               | `/opentelemetry.proto.collector.trace.v1.TraceService/Export`                   |
| `header`                                  | Add a HTTP header key/value pair. Multiple headers can be set.                                                                                                                                            | *none*                                                                          |
| `host`                                    | IP address or hostname of the target OTLP server.                                                                                                                                                         | `127.0.0.1`                                                                     |
| `http2`                                   | Control HTTP/2 independently of `grpc`. Accepted values are `on`, `off`, and `force`. With TLS, `on` negotiates the protocol and `force` requires HTTP/2. You don't need to set this when `grpc` is `on`. | `off`                                                                           |
| `http_passwd`                             | Set HTTP auth password.                                                                                                                                                                                   | *none*                                                                          |
| `http_user`                               | Set HTTP auth user.                                                                                                                                                                                       | *none*                                                                          |
| `log_level`                               | Specifies the log level for output plugin. If not set here, plugin uses global log level in `service` section.                                                                                            | `info`                                                                          |
| `log_response_payload`                    | Specify if the response payload should be logged or not.                                                                                                                                                  | `true`                                                                          |
| `log_suppress_interval`                   | Suppresses log messages from output plugin that appear similar within a specified time interval. `0` disables suppression.                                                                                | `0`                                                                             |
| `logs_attributes_metadata_key`            | Specify an `Attributes` key.                                                                                                                                                                              | `$Attributes`                                                                   |
| `logs_body_key`                           | Set a record accessor that selects the value to use as the OTLP log body.                                                                                                                                 | *none*                                                                          |
| `logs_body_key_attributes`                | If set and it matched a pattern, it includes the remaining fields in the record as attributes.                                                                                                            | `false`                                                                         |
| `logs_instrumentation_scope_metadata_key` | Specify an `InstrumentationScope` key.                                                                                                                                                                    | `InstrumentationScope`                                                          |
| `logs_max_resources`                      | Set the maximum number of OTLP log resources per export request (`0` disables the limit).                                                                                                                 | `0`                                                                             |
| `logs_max_scopes`                         | Set the maximum number of OTLP log scopes per resource (`0` disables the limit).                                                                                                                          | `0`                                                                             |
| `logs_metadata_key`                       | Set the key to look up in the metadata.                                                                                                                                                                   | `otlp`                                                                          |
| `logs_observed_timestamp_metadata_key`    | Specify an `ObservedTimestamp` key.                                                                                                                                                                       | `$ObservedTimestamp`                                                            |
| `logs_resource_metadata_key`              | Specify a `Resource` key.                                                                                                                                                                                 | `Resource`                                                                      |
| `logs_severity_number_message_key`        | Specify a `SeverityNumber` key.                                                                                                                                                                           | `$severityNumber`                                                               |
| `logs_severity_number_metadata_key`       | Specify a `SeverityNumber` key.                                                                                                                                                                           | `$SeverityNumber`                                                               |
| `logs_severity_text_message_key`          | Specify a `SeverityText` key.                                                                                                                                                                             | `$SeverityText`                                                                 |
| `logs_severity_text_metadata_key`         | Specify a `SeverityText` key.                                                                                                                                                                             | `$SeverityText`                                                                 |
| `logs_span_id_message_key`                | Specify a `SpanId` key.                                                                                                                                                                                   | `$SpanId`                                                                       |
| `logs_span_id_metadata_key`               | Specify a `SpanId` key.                                                                                                                                                                                   | `$SpanId`                                                                       |
| `logs_timestamp_metadata_key`             | Specify a `Timestamp` key.                                                                                                                                                                                | `$Timestamp`                                                                    |
| `logs_trace_flags_metadata_key`           | Specify a `TraceFlags` key.                                                                                                                                                                               | `$TraceFlags`                                                                   |
| `logs_trace_id_message_key`               | Specify a `TraceId` key.                                                                                                                                                                                  | `$TraceId`                                                                      |
| `logs_trace_id_metadata_key`              | Specify a `TraceId` key.                                                                                                                                                                                  | `$TraceId`                                                                      |
| `logs_uri`                                | Specify an optional HTTP URI for the target OTel endpoint.                                                                                                                                                | `/v1/logs`                                                                      |
| `match`                                   | Set a tag pattern to match records that output should process. Exact matches or wildcards (for example `*`).                                                                                              | *none*                                                                          |
| `match_regex`                             | Set a regular expression to match tags for output routing. This allows more flexible matching compared to wildcards.                                                                                      | *none*                                                                          |
| `metrics_uri`                             | Specify an optional HTTP URI for the target OTel endpoint.                                                                                                                                                | `/v1/metrics`                                                                   |
| `net.connect_timeout`                     | Set maximum time allowed to establish a connection, this time includes the TLS handshake.                                                                                                                 | `10s`                                                                           |
| `net.connect_timeout_log_error`           | On connection timeout, specify if it should log an error. When disabled, the timeout is logged as a debug message.                                                                                        | `true`                                                                          |
| `net.dns.mode`                            | Select the primary DNS connection type (TCP or UDP).                                                                                                                                                      | *none*                                                                          |
| `net.dns.prefer_ipv4`                     | Select the primary DNS resolver type (LEGACY or ASYNC).                                                                                                                                                   | *none*                                                                          |
| `net.dns.prefer_ipv6`                     | Prioritize IPv6 DNS results when trying to establish a connection.                                                                                                                                        | *none*                                                                          |
| `net.io_timeout`                          | Set maximum time a connection can stay idle while assigned.                                                                                                                                               | `0s`                                                                            |
| `net.keepalive_max_recycle`               | Set maximum number of times a keepalive connection can be used before it retries.                                                                                                                         | `2000`                                                                          |
| `net.max_worker_connections`              | Set the maximum number of active TCP connections that can be used per worker thread.                                                                                                                      | `0`                                                                             |
| `net.proxy_env_ignore`                    | Ignore the environment variables `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` when set.                                                                                                                     | `false`                                                                         |
| `net.source_address`                      | Specify network address to bind for data traffic.                                                                                                                                                         | *none*                                                                          |
| `net.tcp_keepalive`                       | Enable or disable Keepalive support.                                                                                                                                                                      | `off`                                                                           |
| `net.tcp_keepalive_interval`              | Interval between TCP keepalive probes when no response is received on a `keepidle` probe.                                                                                                                 | `-1`                                                                            |
| `net.tcp_keepalive_probes`                | Number of unacknowledged probes to consider a connection dead.                                                                                                                                            | `-1`                                                                            |
| `net.tcp_keepalive_time`                  | Interval between the last data packet sent and the first TCP keepalive probe.                                                                                                                             | `-1`                                                                            |
| `oauth2.audience`                         | Optional `OAuth 2.0` audience parameter.                                                                                                                                                                  | *none*                                                                          |
| `oauth2.auth_method`                      | `OAuth 2.0` client authentication method. Supported values: `basic`, `post`, `private_key_jwt`.                                                                                                           | `basic`                                                                         |
| `oauth2.client_id`                        | `OAuth 2.0` client ID.                                                                                                                                                                                    | *none*                                                                          |
| `oauth2.client_secret`                    | `OAuth 2.0` client secret.                                                                                                                                                                                | *none*                                                                          |
| `oauth2.connect_timeout`                  | Connect timeout for `OAuth 2.0` token requests.                                                                                                                                                           | `0s`                                                                            |
| `oauth2.enable`                           | Enable `OAuth 2.0` client credentials for outgoing requests.                                                                                                                                              | `false`                                                                         |
| `oauth2.jwt_aud`                          | Audience for `private_key_jwt` JSON Web Token (JWT) assertion. Defaults to the value of `oauth2.token_url` when not set.                                                                                  | *none*                                                                          |
| `oauth2.jwt_cert_file`                    | Path to certificate file used by `private_key_jwt`.                                                                                                                                                       | *none*                                                                          |
| `oauth2.jwt_header`                       | JWT header claim name for `private_key_jwt` thumbprint. Accepted values: `kid`, `x5t`.                                                                                                                    | `kid`                                                                           |
| `oauth2.jwt_key_file`                     | Path to PEM private key file used by `private_key_jwt`.                                                                                                                                                   | *none*                                                                          |
| `oauth2.jwt_ttl_seconds`                  | Lifetime in seconds for `private_key_jwt` JWT client assertions.                                                                                                                                          | `300`                                                                           |
| `oauth2.refresh_skew_seconds`             | Seconds before expiry at which to refresh the access token.                                                                                                                                               | `60`                                                                            |
| `oauth2.resource`                         | Optional `OAuth 2.0` resource parameter.                                                                                                                                                                  | *none*                                                                          |
| `oauth2.scope`                            | Optional `OAuth 2.0` scope.                                                                                                                                                                               | *none*                                                                          |
| `oauth2.timeout`                          | Timeout for `OAuth 2.0` token requests.                                                                                                                                                                   | `0s`                                                                            |
| `oauth2.token_url`                        | `OAuth 2.0` token endpoint URL.                                                                                                                                                                           | *none*                                                                          |
| `oauth2.user_agent`                       | Optional `User-Agent` header value to include in `OAuth 2.0` token requests. If omitted, no `User-Agent` header is sent.                                                                                  | *none*                                                                          |
| `port`                                    | TCP port of the target OTLP server.                                                                                                                                                                       | `80`                                                                            |
| `profiles_uri`                            | Specify an optional HTTP URI for the profiles OTel endpoint.                                                                                                                                              | `/v1development/profiles`                                                       |
| `proxy`                                   | Specify an HTTP Proxy. The expected format of this value is `http://host:port`.                                                                                                                           | *none*                                                                          |
| `retry_limit`                             | Set retry limit for output plugin when delivery fails. Integer, `no_limits`, `false`, or `off` to disable, or `no_retries` to disable retries entirely.                                                   | `1`                                                                             |
| `tls`                                     | Enable or disable TLS/SSL support.                                                                                                                                                                        | `off`                                                                           |
| `tls.ca_file`                             | Absolute path to CA certificate file.                                                                                                                                                                     | *none*                                                                          |
| `tls.ca_path`                             | Absolute path to scan for certificate files.                                                                                                                                                              | *none*                                                                          |
| `tls.ciphers`                             | Specify TLS ciphers up to TLSv1.2.                                                                                                                                                                        | *none*                                                                          |
| `tls.crt_file`                            | Absolute path to Certificate file.                                                                                                                                                                        | *none*                                                                          |
| `tls.debug`                               | Set TLS debug level. Accepts `0` (No debug), `1`(Error), `2` (State change), `3` (Informational) and `4` (Verbose).                                                                                       | `1`                                                                             |
| `tls.key_file`                            | Absolute path to private Key file.                                                                                                                                                                        | *none*                                                                          |
| `tls.key_passwd`                          | Optional password for tls.key\_file.                                                                                                                                                                      | *none*                                                                          |
| `tls.max_version`                         | Specify the maximum version of TLS.                                                                                                                                                                       | *none*                                                                          |
| `tls.min_version`                         | Specify the minimum version of TLS.                                                                                                                                                                       | *none*                                                                          |
| `tls.verify`                              | Force certificate validation.                                                                                                                                                                             | `on`                                                                            |
| `tls.verify_hostname`                     | Enable or disable to verify hostname.                                                                                                                                                                     | `off`                                                                           |
| `tls.vhost`                               | Hostname to be used for TLS SNI extension.                                                                                                                                                                | *none*                                                                          |
| `tls.windows.certstore_name`              | Sets the `certstore` name on an output (Windows).                                                                                                                                                         | *none*                                                                          |
| `tls.windows.use_enterprise_store`        | Sets whether using enterprise `certstore` or not on an output (Windows).                                                                                                                                  | *none*                                                                          |
| `traces_uri`                              | Specify an optional HTTP URI for the target OTel endpoint.                                                                                                                                                | `/v1/traces`                                                                    |
| `workers`                                 | The number of [workers](/manual/4.2/administration/multithreading.md#outputs) to perform flush operations for this output.                                                                                | `0`                                                                             |

## Get started

The following example exports log records generated by the dummy plugin, host metrics collected by the node exporter metrics plugin, and traces generated by the event type input. It uses OTLP/HTTP over TLS.

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
# Dummy Logs and traces with Node Exporter Metrics export using OpenTelemetry output plugin
# -------------------------------------------
# The following example collects host metrics on Linux and dummy logs and traces and delivers
# them through the OpenTelemetry plugin to a local collector :
#
service:
  flush: 1
  log_level: info

pipeline:
  inputs:
    - name: node_exporter_metrics
      tag: node_metrics
      scrape_interval: 2

    - name: dummy
      tag: dummy.log
      rate: 3

    - name: event_type
      type: traces

  outputs:
    - name: opentelemetry
      match: "*"
      host: localhost
      port: 443
      metrics_uri: /v1/metrics
      logs_uri: /v1/logs
      traces_uri: /v1/traces
      log_response_payload: true
      tls: on
      tls.verify: off
      logs_body_key: $message
      logs_span_id_message_key: span_id
      logs_trace_id_message_key: trace_id
      logs_severity_text_message_key: loglevel
      logs_severity_number_message_key: lognum
      # add user-defined labels
      add_label:
        - app fluent-bit
        - color blue
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```
# Dummy Logs and traces with Node Exporter Metrics export using OpenTelemetry output plugin
# -------------------------------------------
# The following example collects host metrics on Linux and dummy logs and traces and delivers
# them through the OpenTelemetry plugin to a local collector :
#
[SERVICE]
  Flush                1
  Log_Level            info

[INPUT]
  Name                 node_exporter_metrics
  Tag                  node_metrics
  Scrape_Interval      2

[INPUT]
  Name                 dummy
  Tag                  dummy.log
  Rate                 3

[INPUT]
  Name                 event_type
  Type                 traces

[OUTPUT]
  Name                 opentelemetry
  Match                *
  Host                 localhost
  Port                 443
  Metrics_uri          /v1/metrics
  Logs_uri             /v1/logs
  Traces_uri           /v1/traces
  Log_response_payload True
  Tls                  On
  Tls.verify           Off
  Logs_Body_Key $message
  Logs_Span_Id_Message_Key span_id
  Logs_Trace_Id_Message_Key trace_id
  Logs_Severity_Text_Message_Key loglevel
  Logs_Severity_Number_Message_Key lognum
  # add user-defined labels
  Add_Label            app fluent-bit
  Add_Label            color blue
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fluentbit.io/manual/4.2/data-pipeline/outputs/opentelemetry.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
