FluentBit with Opentelemetry #11382
Unanswered
mahendrakumawat2208
asked this question in
Q&A
Replies: 1 comment
-
|
is anyone there ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Statement: Missing trace_id and span_id in Fluent Bit → OTEL Collector → Kafka Pipeline
Service Overview:-->
Service type: Java Spring Boot microservice
Runtime: Kubernetes
Instrumentation: OpenTelemetry Java Agent
Signals: Logs and Traces
Data Flow:->
Java service emits OTLP logs and traces
Data is sent to Fluent Bit using the OpenTelemetry input
Fluent Bit forwards data to the OpenTelemetry Collector
OpenTelemetry Collector exports data to Kafka
Fluent Bit Configuration (OTLP → OTLP):->
`service:
flush: 1
log_level: debug
hot_reload: 'on'
pipeline:
inputs:
- name: opentelemetry
port: 4328
processors:
logs:
- name: opentelemetry_envelope
outputs:
- name: opentelemetry
match: '*'
host:
port: 32002
traces_uri: /v1/traces
logs_uri: /v1/logs
logs_span_id_message_key: log_metadata.otlp.span_id
logs_trace_id_message_key: log_metadata.otlp.trace_id
log_response_payload: false
tls: 'off'
`
With this configuration:
Logs reach Kafka successfully
trace_id and span_id are missing in the final data
Debugging Approach:->
To isolate the issue, I changed the Fluent Bit output to stdout and inspected the logs directly in the Fluent Bit console.
Debug Configuration (OTLP → stdout)
`service:
flush: 1
log_level: debug
hot_reload: 'on'
pipeline:
inputs:
- name: opentelemetry
port: 4328
processors:
logs:
- name: opentelemetry_envelope
outputs:
- name: stdout
match: '*'
format: json_lines
`
Observed Output in Fluent Bit Console
In this configuration, the logs do contain both trace_id and span_id, nested under log_metadata.otlp
Sample Log Entry:
{ "date": 1768975079.299027, "__internal__": { "group_attributes": { "resource": { "attributes": { "service.name": "jio-hcmp-siem-consumer-service", "telemetry.sdk.language": "java", "telemetry.sdk.version": "1.27.0" }, "schema_url": "https://opentelemetry.io/schemas/1.20.0" }, "scope": { "name": "com.jio.ngo.aspect.FunctionAspect" } } }, "log_metadata": { "otlp": { "observed_timestamp": 1768975079989153656, "timestamp": 1768975079989000000, "severity_number": 9, "severity_text": "INFO", "trace_id": "{S\u0004MBJIp", "span_id": ">k!\u0205p|", "trace_flags": 1 } }, "message": { "event_name": "FUNCTION_LOG", "severity_level": "INFO", "action_status": "SUCCESS", "responseTime": 61 } }Key Observation
trace_id and span_id are present in Fluent Bit
They are lost when forwarding via the OTLP output
The fields exist at:
log_metadata.otlp.trace_id
log_metadata.otlp.span_id
Beta Was this translation helpful? Give feedback.
All reactions