Fluentd

On this page 7

Fluentd is an open-source data collector that gathers log events from many sources, converts them into a unified structured format and routes them to one or more destinations such as search engines, object storage or alerting systems. In monitoring and logging for Servers, Fluentd acts as a unified logging layer that decouples the applications producing logs from the systems that store and analyze them.

The project was started in 2011 and later became a graduated Cloud Native Computing Foundation project, a status reserved for mature and widely adopted software. It is written in C and Ruby, relies on a large plugin ecosystem and is a common choice for log aggregation in both traditional server fleets and Kubernetes clusters.

How Fluentd processes log events

Fluentd processes logs as a pipeline of input, filter, buffer and output stages, and every record passing through it is an event with three parts. The tag identifies where the event came from, the time records when it happened, and the record holds the actual data as a JSON-like map of keys and values.

Tags drive routing: configuration blocks match tag patterns such as app.web.* and send matching events to specific filters and outputs. Because every event is structured, downstream systems receive consistent fields instead of free-form text lines that must be parsed again.

The following table summarizes the main stages of the pipeline and their configuration directives.

StageConfiguration directivePurposeTypical plugin
InputsourceReceives or reads raw eventsin_tail, in_forward, in_syslog
Parserparse sectionTurns text lines into fieldsregexp, json, nginx
FilterfilterEnriches, modifies or drops eventsrecord_transformer, grep
Bufferbuffer sectionHolds events before deliverymemory, file
OutputmatchDelivers events to destinationsout_s3, out_forward, Elasticsearch
Fluentd pipeline stages

Fluentd can also group routes with the label directive, which keeps complex configurations readable by separating independent pipelines inside one process.

Buffering, retries and delivery guarantees

Buffering is what makes Fluentd reliable under network failures and destination outages. Output plugins write events into chunks, which are flushed to the destination at intervals or when they reach a size limit. If delivery fails, Fluentd retries with exponential backoff instead of discarding data immediately.

The choice of buffer type is the central trade-off between speed and durability. Memory buffers are fast but lose their contents if the process crashes, while file buffers survive restarts at the cost of disk input and output.

Buffer typeDurabilityThroughputBest fit
Memory bufferLost on crash or restartHighestShort-lived or low-value logs
File bufferSurvives restartsSlightly lowerAudit, security and billing logs
File buffer with overflow action blockSurvives restartsSlows inputs when fullLogs that must never be dropped
Overflow action drop oldestOlder chunks discardedStable under pressureHigh-volume debug data
Buffer options and their consequences

Fluentd provides at-most-once delivery by default and can approach at-least-once delivery when the forward protocol uses acknowledgments and the buffer is on disk. Duplicates are therefore possible after retries, and destinations that require exact counts need deduplication by event identifier.

Fluentd sits in a crowded field of log collectors, and the right choice depends on resource budget, plugin needs and the surrounding stack. Its closest relative is Fluent Bit, a lightweight sibling written in C under the same project umbrella.

ToolImplementationTypical memory useMain strength
FluentdC and RubyTens of megabytesVery large plugin ecosystem
Fluent BitCA few megabytesEdge and node agents, low overhead
LogstashJVM basedHundreds of megabytesRich transformations in the ELK stack
Syslog daemonsCVery smallStandard system logging on Linux
Fluentd and neighboring tools

A common architecture combines both members of the family: Fluent Bit runs on every node as a light forwarder, and a smaller pool of Fluentd aggregators performs heavy parsing, enrichment and fan-out to several back ends. This split keeps per-node overhead low while retaining Fluentd’s flexibility.

Deploying Fluentd on servers and clusters

Fluentd is deployed either as a node-level agent that tails local files or as a central aggregator that receives events over the network. The native forward protocol, usually on TCP port 24224, connects agents and aggregators and supports optional TLS and shared-key authentication.

The decision table below shows how deployment patterns map to common environments.

SituationRecommended patternReason
Small fleet of virtual machinesAgent on each server sending directly to storageFewest moving parts
Large server fleetAgents forwarding to an aggregator tierCentral control of parsing and routing
Kubernetes clusterDaemonSet collecting container logsOne collector per node, automatic metadata
Multiple destinationsAggregator with copy outputOne event stream feeds several systems
Choosing a deployment pattern

In Kubernetes, a metadata filter adds pod name, namespace and labels to every record, which makes logs searchable by workload. Operators should also enable Fluentd’s built-in monitoring endpoint to watch buffer length and retry counts, because a growing buffer is the earliest sign of a failing destination.

Limitations and operational pitfalls

Fluentd is flexible, but misconfiguration and resource limits cause most production incidents. Experienced operators watch for these issues:

  • Ruby performance ceilings: a single worker uses one CPU core, so very high event rates require multi-worker mode or offloading to Fluent Bit.
  • Unbounded buffers: without size limits, a destination outage can fill memory or disk and destabilize the host.
  • Fragile regular expressions: parsers that fail silently produce unstructured records and break dashboards.
  • Tag pattern order: match blocks are evaluated top to bottom, so a broad pattern placed early swallows events intended for later routes.
  • Plugin quality varies: community plugins differ in maintenance and should be pinned to tested versions.

Treat the collector itself as a monitored production service, with health checks, log rotation awareness and capacity planning, rather than as a background utility that never fails.

Put simply

Fluentd works like a mail sorting center for log messages. Programs on a server constantly write notes about what they are doing. Fluentd picks up these notes, puts them into the same neat envelope format, labels each one, and sends it to the right place, such as a search tool or long-term storage.

If the destination is temporarily closed, Fluentd keeps the notes in a waiting room and tries again later, so fewer messages are lost. This lets teams see everything happening across many servers in one place.

In practice

A software company runs about 200 containers across a 12-node Kubernetes cluster. Each node runs a Fluentd DaemonSet pod that tails container log files, parses web server access lines into fields such as status code and latency, and adds the pod name and namespace to every event.

The agents forward events to two aggregator instances using file buffers limited to 8 GB each. The aggregators copy every stream to a search cluster for fourteen days of interactive analysis and to object storage for one year of retention. When the search cluster goes down for a two-hour upgrade, buffers grow to about 3 GB and then drain automatically afterward, so the team loses no access logs and the security audit trail remains complete.