Sending FluentBit logs to Uptrace
FluentBit is an open-source and multi-platform log processor and forwarder that allows you to collect data/logs from different sources, unify and filter them, and send them to multiple destinations.
Configuration
To configure FluentBit to send logs to Uptrace, use the OpenTelemetry output and pass your project DSN via HTTP headers.
For example, to collect syslog messages, you can create the following FluentBit config:
[SERVICE]
Flush 3
Log_level info
Parsers_File /etc/fluent-bit/parsers.conf
[INPUT]
Name Tail
Path /var/log/syslog
Path_Key log_file
DB /run/fluent-bit-messages.state
Parser syslog-rfc3164
[OUTPUT]
Name opentelemetry
Match *
Host otlp.uptrace.dev
Port 443
Header uptrace-dsn https://FIXME@api.uptrace.dev?grpc=4317
Compress gzip
Metrics_uri /v1/metrics
Logs_uri /v1/logs
Traces_uri /v1/traces
Log_response_payload True
Tls On
Tls.verify Off
# add user-defined labels
add_label service.name myservice
add_label log.source fluent-bit
[SERVICE]
Flush 3
Log_level info
Parsers_File /etc/fluent-bit/parsers.conf
[INPUT]
Name Tail
Path /var/log/syslog
Path_Key log_file
DB /run/fluent-bit-messages.state
Parser syslog-rfc3164
[OUTPUT]
Name opentelemetry
Match *
Host localhost
Port 14318
Header uptrace-dsn http://project2_secret_token@localhost:14318?grpc=14317
Compress gzip
Metrics_uri /v1/metrics
Logs_uri /v1/logs
Traces_uri /v1/traces
Log_response_payload True
Tls Off
Tls.verify Off
# add user-defined labels
add_label service.name myservice
add_label log.source fluent-bit
Copy the config above to fluent-bit.conf
and then start FluentBit:
fluent-bit -c fluent-bit.conf