Fluentd vs. Kafka: where each belongs in a logging pipeline

Understand Fluentd collection and routing, Kafka retention and replay, and when a broker is worth the operational complexity.

Best practices
Illustration of log collection and monitoring

Fluentd collects, parses, and routes events. Kafka stores event streams in partitioned topics so independent consumers can read them at their own pace. A logging system may use both, but adding Kafka is useful only when you need the buffering, replay, or consumer separation it provides.

Compare their responsibilities

Requirement Fluentd Kafka
Collect a local log file Input plugins such as tail read and parse it Usually requires a collector, connector, or application producer
Transform a record Filters and plugins modify or route it Applications, Kafka Streams, connectors, or other processors handle transformations
Survive a destination outage Configured memory or file buffers hold pending output within limits Topics retain records under retention and replication policies
Read old events again Output buffers are not a general replay archive Consumers can reread retained records by changing offsets
Deliver to several destinations copy and output plugins support fan-out Independent consumer groups maintain separate progress
Operational work Configure plugins, buffers, retry policies, and host resources Operate or purchase brokers, storage, replication, topics, and consumer capacity

Neither has a meaningful universal events-per-second figure. Message size, parsing, compression, acknowledgments, and storage durability change the workload substantially.

When Fluentd alone is enough

If you need to collect logs and send them to Elasticsearch or object storage, a Fluentd pipeline with appropriately sized file buffers may be sufficient. Set limits and an overflow policy, monitor queued data, and test recovery after a destination outage. A disk buffer helps with process restarts but is not unlimited storage or an unconditional no-loss guarantee.

When to add Kafka

Kafka is useful when several teams consume the same events independently, when you need replay after a processing change, or when producers must continue through a longer downstream outage. Retention and disk capacity must cover the intended recovery window. Consumers still need enough spare throughput to catch up.

One possible architecture is:

Applications → Fluent Bit → Kafka → Logstash → Elasticsearch → Kibana

Fluentd can fill the collection or processing role instead, using a compatible Kafka plugin. Fluent Bit may suit node-level collection when its supported inputs and transformations meet the requirement. These are architecture choices, not interchangeable configurations.

FAQ

Will a crash lose logs?

That depends on the whole path. Fluentd file buffers need persistent, healthy storage and compatible retry/overflow settings. Kafka durability depends on replication and producer acknowledgment settings, among other factors. Uncollected application logs, ephemeral disks, and full queues remain possible loss points. Test the failure cases your service must tolerate.

Does Kafka replace Logstash parsing?

Kafka brokers do not automatically parse application logs into a search schema. Kafka Streams, Flink, or other consumers can implement processing, but that introduces application logic to operate. Use Logstash or another processor when its parsing model fits your workload.

References: Kafka concepts and Fluentd buffering.

Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting