You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OpenTelemetry plugin lets you take logs, metrics, traces, and profiles from Fluent Bit and submit them to an OpenTelemetry HTTP endpoint.
7
+
The OpenTelemetry plugin lets you take logs, metrics, traces, and profiles from Fluent Bit and submit them to an OpenTelemetry receiver over OTLP/HTTP or OTLP/gRPC.
8
8
9
-
Only HTTP endpoints are supported.
9
+
OTLP/HTTP supports both HTTP/1.1 and HTTP/2. OTLP/gRPC requires HTTP/2 and is enabled with the `grpc` option.
10
10
11
11
12
12
| Key | Description | Default |
@@ -22,42 +22,43 @@ Only HTTP endpoints are supported.
22
22
|`aws_sts_endpoint`| Custom endpoint for the AWS STS API, used with the `aws_role_arn` option. |_none_|
23
23
|`batch_size`| Set the maximum number of log records to be flushed at a time. |`1000`|
24
24
|`compress`| Set payload compression mechanism. Options available are `gzip` and `zstd`. |_none_|
|`grpc_logs_uri`| Specify an optional gRPC URI for the target OTel endpoint. |`/opentelemetry.proto.collector.logs.v1.LogsService/Export`|
27
-
|`grpc_metrics_uri`| Specify an optional gRPC URI for the target OTel endpoint. |`/opentelemetry.proto.collector.metrics.v1.MetricsService/Export`|
28
-
|`grpc_profiles_uri`| Specify an optional gRPC URI for profiles OTel endpoint. |`/opentelemetry.proto.collector.profiles.v1experimental.ProfilesService/Export`|
29
-
|`grpc_traces_uri`| Specify an optional gRPC URI for the target OTel endpoint. |`/opentelemetry.proto.collector.trace.v1.TraceService/Export`|
25
+
|`encoding`| Set the encoding used to send logs, metrics, and traces over OTLP/HTTP. Accepted values: `protobuf` (default, `Content-Type: application/x-protobuf`) or `json` (`Content-Type: application/json`). Profiles always use `protobuf`. |`protobuf`|
26
+
|`grpc`| Enable gRPC transport (OTLP/gRPC). When enabled, HTTP/2 is automatically activated. Accepted values: `on`, `off`. |`off`|
27
+
|`grpc_logs_uri`| gRPC endpoint URI for log exports. |`/opentelemetry.proto.collector.logs.v1.LogsService/Export`|
28
+
|`grpc_metrics_uri`| gRPC endpoint URI for metric exports. |`/opentelemetry.proto.collector.metrics.v1.MetricsService/Export`|
29
+
|`grpc_profiles_uri`| gRPC endpoint URI for profile exports. |`/opentelemetry.proto.collector.profiles.v1experimental.ProfilesService/Export`|
30
+
|`grpc_traces_uri`| gRPC endpoint URI for trace exports. |`/opentelemetry.proto.collector.trace.v1.TraceService/Export`|
30
31
|`header`| Add a HTTP header key/value pair. Multiple headers can be set. |_none_|
31
32
|`host`| IP address or hostname of the target HTTP server. |`127.0.0.1`|
32
-
|`http2`| Enable, disable or force HTTP/2 usage. Accepted values: `on`, `off`, or `force`. |`off`|
33
+
|`http2`| Enable, disable or force HTTP/2 usage. Accepted values: `on`, `off`, or `force`.|`off`|
33
34
|`http_passwd`| Set HTTP auth password. |_none_|
34
35
|`http_user`| Set HTTP auth user. |_none_|
35
36
|`log_level`| Specifies the log level for output plugin. If not set here, plugin uses global log level in `service` section. |`info`|
36
37
|`log_response_payload`| Specify if the response payload should be logged or not. |`true`|
37
38
|`log_suppress_interval`| Suppresses log messages from output plugin that appear similar within a specified time interval. `0` disables suppression. |`0`|
38
-
|`logs_attributes_metadata_key`|Specify an `Attributes`key. |`$Attributes`|
39
-
|`logs_body_key`|Specify an optional HTTP URI for the target OTel endpoint. |_none_|
40
-
|`logs_body_key_attributes`|If set and it matched a pattern, it includes the remaining fields in the record as attributes. |`false`|
41
-
|`logs_instrumentation_scope_metadata_key`|Specify an `InstrumentationScope`key. |`InstrumentationScope`|
39
+
|`logs_attributes_metadata_key`|Metadata key used to read log record attributes.|`$Attributes`|
40
+
|`logs_body_key`|Record accessor pattern(s) used to populate the OTLP log body. The first matching key wins. May be specified multiple times. Defaults to `$log` then `$message`.|_none_|
41
+
|`logs_body_key_attributes`|When `true`, record fields not matched by `logs_body_key` are added to the log record's attributes instead of being dropped.|`false`|
42
+
|`logs_instrumentation_scope_metadata_key`|Metadata key used to read the instrumentation scope.|`InstrumentationScope`|
42
43
|`logs_max_resources`| Set the maximum number of OTLP log resources per export request (`0` disables the limit). |`0`|
43
44
|`logs_max_scopes`| Set the maximum number of OTLP log scopes per resource (`0` disables the limit). |`0`|
44
-
|`logs_metadata_key`|Set the key to look up in the metadata. |`otlp`|
45
-
|`logs_observed_timestamp_metadata_key`|Specify an `ObservedTimestamp`key. |`$ObservedTimestamp`|
46
-
|`logs_resource_metadata_key`|Specify a `Resource`key. |`Resource`|
47
-
|`logs_severity_number_message_key`|Specify a `SeverityNumber`key. |`$severityNumber`|
48
-
|`logs_severity_number_metadata_key`|Specify a `SeverityNumber`key. |`$SeverityNumber`|
49
-
|`logs_severity_text_message_key`|Specify a `SeverityText`key. |`$SeverityText`|
50
-
|`logs_severity_text_metadata_key`|Specify a `SeverityText`key. |`$SeverityText`|
51
-
|`logs_span_id_message_key`|Specify a `SpanId`key. |`$SpanId`|
52
-
|`logs_span_id_metadata_key`|Specify a `SpanId`key. |`$SpanId`|
53
-
|`logs_timestamp_metadata_key`|Specify a `Timestamp`key. |`$Timestamp`|
54
-
|`logs_trace_flags_metadata_key`|Specify a `TraceFlags`key. |`$TraceFlags`|
55
-
|`logs_trace_id_message_key`|Specify a `TraceId`key. |`$TraceId`|
56
-
|`logs_trace_id_metadata_key`|Specify a `TraceId`key. |`$TraceId`|
57
-
|`logs_uri`|Specify an optional HTTP URI for the target OTel endpoint. |`/v1/logs`|
45
+
|`logs_metadata_key`|Top-level metadata key used to look up OTLP metadata added by `in_opentelemetry`.|`otlp`|
46
+
|`logs_observed_timestamp_metadata_key`|Metadata key used to read the observed timestamp.|`$ObservedTimestamp`|
47
+
|`logs_resource_metadata_key`|Metadata key used to read the OTLP resource.|`Resource`|
48
+
|`logs_severity_number_message_key`|Record body key used to read the severity number.|`$SeverityNumber`|
49
+
|`logs_severity_number_metadata_key`|Metadata key used to read the severity number.|`$SeverityNumber`|
50
+
|`logs_severity_text_message_key`|Record body key used to read the severity text.|`$SeverityText`|
51
+
|`logs_severity_text_metadata_key`|Metadata key used to read the severity text.|`$SeverityText`|
52
+
|`logs_span_id_message_key`|Record body key used to read the span ID.|`$SpanId`|
53
+
|`logs_span_id_metadata_key`|Metadata key used to read the span ID.|`$SpanId`|
54
+
|`logs_timestamp_metadata_key`|Metadata key used to read the log timestamp.|`$Timestamp`|
55
+
|`logs_trace_flags_metadata_key`|Metadata key used to read the trace flags.|`$TraceFlags`|
56
+
|`logs_trace_id_message_key`|Record body key used to read the trace ID.|`$TraceId`|
57
+
|`logs_trace_id_metadata_key`|Metadata key used to read the trace ID.|`$TraceId`|
58
+
|`logs_uri`| HTTP URI for the logs OTLP endpoint.|`/v1/logs`|
58
59
|`match`| Set a tag pattern to match records that output should process. Exact matches or wildcards (for example `*`). |_none_|
59
60
|`match_regex`| Set a regular expression to match tags for output routing. This allows more flexible matching compared to wildcards. |_none_|
60
-
|`metrics_uri`|Specify an optional HTTP URI for the target OTel endpoint. |`/v1/metrics`|
61
+
|`metrics_uri`| HTTP URI for the metrics OTLP endpoint.|`/v1/metrics`|
61
62
|`net.connect_timeout`| Set maximum time allowed to establish a connection, this time includes the TLS handshake. |`10s`|
62
63
|`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`|
63
64
|`net.dns.mode`| Select the primary DNS connection type (TCP or UDP). |_none_|
@@ -89,7 +90,7 @@ Only HTTP endpoints are supported.
89
90
|`oauth2.timeout`| Timeout for `OAuth 2.0` token requests. |`0s`|
|`port`| TCP port of the target HTTP server. |`80`|
92
-
|`profiles_uri`|Specify an optional HTTP URI for the profiles OTel endpoint. |`/v1development/profiles`|
93
+
|`profiles_uri`| HTTP URI for the profiles OTLP endpoint.|`/v1development/profiles`|
93
94
|`proxy`| Specify an HTTP Proxy. The expected format of this value is `http://host:port`.|_none_|
94
95
|`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`|
95
96
|`tls`| Enable or disable TLS/SSL support. |`off`|
@@ -107,22 +108,58 @@ Only HTTP endpoints are supported.
107
108
|`tls.vhost`| Hostname to be used for TLS SNI extension. |_none_|
108
109
|`tls.windows.certstore_name`| Sets the `certstore` name on an output (Windows). |_none_|
109
110
|`tls.windows.use_enterprise_store`| Sets whether using enterprise `certstore` or not on an output (Windows). |_none_|
110
-
|`traces_uri`|Specify an optional HTTP URI for the target OTel endpoint. |`/v1/traces`|
111
+
|`traces_uri`| HTTP URI for the traces OTLP endpoint.|`/v1/traces`|
111
112
|`workers`| The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. |`0`|
112
113
113
114
## Get started
114
115
115
-
The OpenTelemetry plugin works with logs and only the metrics collected from one of the metric input plugins. In the following example, log records generated by the dummy plugin and the host metrics collected by the node exporter metrics plugin are exported by the OpenTelemetry output plugin.
116
+
The OpenTelemetry plugin supports all four OTLP signal types: logs, metrics, traces, and profiles. In the following example, log records generated by the dummy plugin and host metrics from the node exporter metrics plugin are exported together over OTLP/HTTP.
117
+
118
+
### Encoding
119
+
120
+
By default the plugin sends all signals as binary protobuf (`Content-Type: application/x-protobuf`). Set `encoding json` to send logs, metrics, and traces as OTLP JSON (`Content-Type: application/json`) instead. This is useful when sending to receivers that only accept JSON, such as HTTP webhook endpoints.
121
+
122
+
{% hint style="info" %}
123
+
The `encoding` option applies to **OTLP/HTTP** exports only. When `grpc` is `on`, logs, metrics, and traces are sent over OTLP/gRPC using protobuf framing.
124
+
125
+
Profiles are always sent as protobuf regardless of the `encoding` setting — no OTLP JSON encoder exists for the profiles signal yet.
126
+
{% endhint %}
127
+
128
+
{% tabs %}
129
+
{% tab title="fluent-bit.yaml" %}
130
+
131
+
```yaml
132
+
pipeline:
133
+
outputs:
134
+
- name: opentelemetry
135
+
match: "*"
136
+
host: localhost
137
+
port: 4318
138
+
encoding: json
139
+
```
140
+
141
+
{% endtab %}
142
+
{% tab title="fluent-bit.conf" %}
143
+
144
+
```text
145
+
[OUTPUT]
146
+
Name opentelemetry
147
+
Match *
148
+
Host localhost
149
+
Port 4318
150
+
Encoding json
151
+
```
152
+
153
+
{% endtab %}
154
+
{% endtabs %}
155
+
156
+
### Full example
116
157
117
158
{% tabs %}
118
159
{% tab title="fluent-bit.yaml" %}
119
160
120
161
```yaml
121
-
# Dummy Logs and traces with Node Exporter Metrics export using OpenTelemetry output plugin
122
-
# -------------------------------------------
123
-
# The following example collects host metrics on Linux and dummy logs and traces and delivers
124
-
# them through the OpenTelemetry plugin to a local collector :
125
-
#
162
+
# Collect host metrics and dummy logs, export via OpenTelemetry output
126
163
service:
127
164
flush: 1
128
165
log_level: info
@@ -156,7 +193,6 @@ pipeline:
156
193
logs_trace_id_message_key: trace_id
157
194
logs_severity_text_message_key: loglevel
158
195
logs_severity_number_message_key: lognum
159
-
# add user-defined labels
160
196
add_label:
161
197
- app fluent-bit
162
198
- color blue
@@ -166,11 +202,7 @@ pipeline:
166
202
{% tab title="fluent-bit.conf" %}
167
203
168
204
```text
169
-
# Dummy Logs and traces with Node Exporter Metrics export using OpenTelemetry output plugin
170
-
# -------------------------------------------
171
-
# The following example collects host metrics on Linux and dummy logs and traces and delivers
172
-
# them through the OpenTelemetry plugin to a local collector :
173
-
#
205
+
# Collect host metrics and dummy logs, export via OpenTelemetry output
0 commit comments