Fluent Bit

On this page 7

Fluent Bit is a lightweight, open-source telemetry agent written in C that collects logs, metrics and traces on a host, processes them in a configurable pipeline and forwards them to one or more destinations. In server monitoring & logs practice it serves as the collection layer at the edge: it runs next to applications on every server, virtual machine or Kubernetes node and ships structured records to systems such as Elasticsearch, Grafana Loki, Splunk or a central Fluentd tier.

The project belongs to the Fluentd ecosystem under the Cloud Native Computing Foundation and is released under the Apache 2.0 license. Its defining trait is a small memory and CPU footprint, which makes it practical to deploy on thousands of nodes, on embedded devices and inside resource-limited containers.

How the Fluent Bit pipeline processes records

Fluent Bit processes data through a fixed sequence of pipeline stages, each implemented by plugins. Every record carries a tag, and routing rules compare that tag with the Match pattern of filters and outputs to decide where the record goes.

StageRoleTypical plugins or settings
InputReads raw data from a sourcetail, systemd, syslog, forward, node_exporter_metrics
ParserTurns unstructured text into fieldsjson, regex, logfmt, docker, cri
FilterEnriches, modifies or drops recordskubernetes, grep, modify, nest, lua
BufferHolds chunks until delivery succeedsMemory or filesystem storage
RouterMatches tags to destinationsMatch and Match_Regex rules
OutputSends data to a backendes, loki, forward, s3, kafka, http
Stages of the Fluent Bit data pipeline

Internally, records are encoded in MessagePack, a compact binary format, and grouped into chunks of roughly two megabytes. Chunks are the unit of buffering, retry and delivery, so a failed output retries whole chunks rather than single lines. An event-driven engine with coroutines lets one process handle many inputs and outputs without a thread per connection.

Fluent Bit compared with Fluentd and other collectors

Fluent Bit and Fluentd share a data model and the forward protocol, but they target different positions in a logging architecture. Fluent Bit is optimized for collection on every node, while Fluentd, written in Ruby with C extensions, offers a larger plugin ecosystem suited to central aggregation.

AgentImplementationTypical roleResource profile
Fluent BitC, plugin-basedNode agent and light aggregatorVery low memory and CPU
FluentdRuby with C extensionsCentral aggregatorModerate, grows with plugins
LogstashJVM-basedHeavy transformation in the ELK stackHigh memory use
FilebeatGoShipper for ElasticsearchLow
VectorRustAgent and aggregatorLow to moderate
Fluent Bit and common alternatives

A frequent design uses Fluent Bit on every node forwarding to a small Fluentd or Fluent Bit aggregation layer, which then handles heavy routing and buffering toward the final store. Smaller environments often skip the aggregator and send directly from Fluent Bit to the backend.

Configuration and deployment patterns

Fluent Bit is configured through a classic INI-style file or a YAML configuration, each with service, input, filter and output sections. The service section sets global values such as the flush interval, log level and the built-in HTTP server on port 2020, which exposes health and Prometheus-format metrics about the agent itself.

Deployment patterns depend on the platform. The table below lists the most common ones and what each collects.

EnvironmentDeployment formMain data sources
Kubernetes clusterDaemonSet, one pod per nodeContainer logs, pod metadata
Linux serversSystem package with a systemd unitJournal, log files, host metrics
Sidecar containerRuns beside one application podApplication-specific log files
Edge and IoT devicesSmall static binarySensor data, local syslog
Aggregation tierDedicated instances behind a load balancerForward protocol from node agents
Common deployment patterns

In Kubernetes, the kubernetes filter queries the API server to attach namespace, pod name, labels and annotations to each container log line. This metadata enrichment is what allows a backend to filter logs by service or deployment rather than by raw file path.

Buffering, backpressure and reliability

Reliability in Fluent Bit depends on how buffering is configured. With the default memory buffering, chunks live only in RAM, so a crash or restart loses data that was not yet delivered, and a slow backend can make memory grow until a limit is reached.

The Mem_Buf_Limit setting caps memory per input and pauses the input when the cap is reached, which protects the host but can drop or delay records from sources that cannot wait. Setting storage.type filesystem writes chunks to disk, so the agent survives restarts and can absorb long backend outages within the configured storage limits.

SettingBehaviorBest suited for
Memory onlyFastest; data lost on crashNon-critical debug logs
Memory with Mem_Buf_LimitInput pauses at the capProtecting node memory
Filesystem storageChunks persisted to diskAudit and production logs
Retry_Limit on outputsBounds retries before discardingControlling backlog growth
Buffering options and their effects

The tail input also keeps a position database in SQLite, so after a restart it resumes reading each file at the last committed offset instead of rereading or skipping lines. Without this database, restarts produce duplicates or gaps.

Common problems and how to avoid them

Most Fluent Bit incidents stem from parsing, multiline handling and tag routing rather than from the engine itself.

  • Broken multiline stack traces: without a multiline parser, each line of a Java or Python exception becomes a separate record.
  • Tag mismatches: a filter whose Match pattern does not cover the input tag silently does nothing.
  • Missing log rotation awareness: incorrect path patterns or an absent position database cause lost lines after rotation.
  • Unbounded memory: memory buffering without limits can trigger the out-of-memory killer on busy nodes.
  • Unfiltered verbosity: forwarding debug-level logs inflates storage costs; the grep filter can drop them at the edge.

The agent’s own metrics endpoint should itself be monitored. Rising retry counts and dropped records are the earliest signal that a backend is overloaded or that credentials have expired.

The idea in brief

Every server writes diaries of what it is doing, called logs. With many servers, reading each diary separately becomes impossible. Fluent Bit is a small helper program that sits on each server, reads those diaries as they are written, tidies them into a consistent format and sends them to one central place.

Think of it as a mail carrier for log messages. It collects letters from every house, labels them, keeps them safe if the post office is closed for a while and delivers them when it opens again. Because it is so light, it can run on every machine without slowing the real work down.

A practical scenario

A software company runs an online booking platform on a Kubernetes cluster of 40 nodes. Developers previously connected to individual pods to read logs, which failed whenever a pod was rescheduled and its logs disappeared. The platform team deploys Fluent Bit as a DaemonSet, with the tail input reading container log files, the CRI parser, a multiline parser for Java exceptions and the kubernetes filter for pod metadata.

Records are sent to Grafana Loki, with filesystem buffering capped at 2 GB per node so that a backend upgrade does not lose data. Each agent uses well under 100 MB of memory on busy nodes. During the next production incident, engineers filter logs by namespace and request ID across all services in seconds, and a 20-minute Loki maintenance window passes with no lost log lines because the buffered chunks are delivered once the backend returns.