When a Kafka write buffer for Loki is worth considering
A Kafka write buffer puts a durable queue between Loki's distributors and its ingesters. With Kafka-based ingestion, the distributor writes log streams as records to a Kafka topic, and each ingester consumes one partition, as described in the Loki Kafka-based ingestion docs. The feature is experimental, so its configuration options and metric names may change between releases. Consider it when a growing cluster faces ingestion spikes or ingester restarts that threaten log loss, and when your team is prepared to run an additional stateful system alongside Loki.
The default write path sends each stream to a set of ingesters directly, and that path is often enough for clusters with steady volume, sized replication and a good label design. Before adding Kafka, confirm the actual failure you are solving: is it bursts that exceed ingester capacity, slow ingester restarts that drop data, or both? Also confirm that your ingestion limits and sender behavior are not the root cause, because a buffer will not fix a noisy sender. Ask whether the Loki version you run supports the feature and which options it exposes, since the docs warn these may change.
Adding Kafka shifts work onto your platform team. You need brokers sized for retention and throughput, partition planning that matches the number of ingesters, topic monitoring, and upgrades that follow Kafka's own support policy. Kafka itself is open source under the Apache License 2.0, so the software carries no license fee, but hosting, staff time and any support contract are real costs. Decide with your architects and the DeployOpen team whether the added resilience justifies the recurring operational load before you commit to a design.
How log streams flow from distributors through Kafka to ingesters
Log shippers push streams to the Loki distributor, which writes them as records to a Kafka topic. The topic is split into partitions, and each ingester consumes one partition, so the Kafka cluster sits between the write path and the ingesters as a separately operated component. Check who owns the Kafka cluster, its access controls and its retention before the first stream arrives, because the ingesters depend on it for every write.
Log streams move from distributors through Kafka partitions to ingesters, then to object storage.
How ingesters consume Kafka partitions
With Kafka-based ingestion, the core planning rule is that each ingester consumes exactly one partition. The distributor writes log streams as records to a Kafka topic, and each ingester reads from its assigned partition, so the partition count of the topic sets the ceiling on how many ingesters can consume in parallel. Plan the two numbers together: if the topic has fewer partitions than you have ingesters, some ingesters will sit idle, and if you later need more write parallelism, adding partitions to a live topic changes how records map to consumers and must be tested first. Decide the partition count, the ingester replica count and the topic's retention before deployment, and record the reasoning so that scaling changes are made deliberately rather than by trial.
Restarts and rebalancing are where operators most often get surprised. When an ingester restarts, the partition it owns is not served by any other process until it comes back, so the buffer in Kafka is what keeps incoming log data from being lost while the ingester is down. Confirm in the documentation for your Loki version how the ingester resumes from its committed offset, how long a partition can lag before it becomes a problem, and whether a partition can be reassigned to another ingester automatically or only through a manual change. Test these paths in a non-production cluster by stopping an ingester under a steady push load and watching lag, consumer status and the experimental metrics the feature exposes.
Because the feature is experimental, treat the exact assignment behavior as something to verify against the Loki release you run, not something to assume from this page. Ask your team to document three things before go-live: the partition-to-ingester mapping, the procedure for an ingester that cannot recover, and the Kafka retention window that gives you enough time to repair it. Reviewing Loki's Kafka-based ingestion documentation against your target version is the natural first step, and any configuration keys or metric names you rely on should be confirmed there before they go into runbooks.
Configuration choices and when each fits
This table compares the main choices a team makes when adding Kafka between Loki distributors and ingesters, against the standard write path. Read each row as a decision: what the option gives you, what it costs to run, and the conditions under which it is worth choosing. Confirm option names and keys against the current Loki Kafka-based ingestion docs before you write any configuration, since the feature is experimental.
| Decision | Option | Trade-off | When it fits |
|---|---|---|---|
| Write path | Standard distributor to ingester path | No Kafka cluster to run, fewer moving parts, and no replay log outside the ingesters | Most clusters, especially where ingestion is steady and the team wants the least operational load |
| Write path | Kafka-based ingestion | Adds a Kafka cluster to secure, size and monitor, and the feature is experimental with settings that may change | Teams that already run Kafka well and want a durable buffer between distributors and ingesters |
| Partition count | Partitions matched to ingesters | Each ingester consumes one partition, so partition count sets the consumer parallelism; changing it later is harder to plan | Predictable ingester count that you can hold steady across rollouts |
| Partition count | Fewer partitions than the ingester fleet | Some ingesters sit idle while others carry the load, which can hide capacity problems | Small clusters or tests where the extra consumers add little value |
| Kafka retention | Retention long enough for replay after an ingester outage | Longer retention means more disk on Kafka brokers and a larger recovery window to plan for | Environments where losing a short window of logs after a failure is unacceptable |
| Kafka retention | Short retention matching ingester recovery time | Less broker disk, but less room to recover from a longer ingester outage | Teams that accept some risk in exchange for lower storage use |
| Kafka security | SASL with SCRAM and TLS on client listeners | More credentials and certificates to rotate, but limits who can write to the topic | Shared or multi-team Kafka clusters, and any network path that leaves a single trust zone |
| Kafka security | Unsecured listeners inside an isolated network | Simpler setup, but anyone on the network can write or read log records | Only isolated test environments with no sensitive log content |
Setting up Kafka-based ingestion in sequence
The sequence below takes a Loki cluster from a version check through a KRaft Kafka deployment, topic and partition planning, distributor and ingester configuration, security and verification. Each step ends with a check that tells you whether to move on.
Confirm Loki version and accept experimental status
Before any infrastructure is built, the platform owner checks the Loki release in use against the Kafka-based ingestion documentation and confirms that the feature's configuration options and metric names may change between releases. Record the target Loki version, the upgrade plan that follows each release, and the rollback path to direct ingestion. The step is done when the risk owner has signed off on running an experimental write path in the target environment, and the Loki version is pinned in your deployment manifests. Confirm the exact supported release and its status with the Loki documentation for your version rather than assuming it from the release list.
Deploy a Kafka cluster in KRaft mode
The platform team deploys Apache Kafka in KRaft mode, since Kafka 4.0 supports only KRaft and ZooKeeper mode has been removed. Size brokers, disks and network for the peak write rate you expect from distributors, and choose a supported Kafka release from the downloads page, noting that rolling upgrades are supported from the last three releases to the latest. The check is that the cluster forms a quorum, every broker is reachable from the distributor and ingester network segments, and a test producer and consumer can exchange a record end to end. Confirm Java runtime requirements for your chosen Kafka version before provisioning hosts.
Create the topic with partitions matched to ingesters
Create the Kafka topic that Loki will use, setting the partition count so each ingester consumes exactly one partition, because the Loki distributor writes streams to the topic and each ingester reads one partition. Ingester count therefore caps consumer parallelism, so plan partitions against the number of ingesters you intend to run, including headroom for scaling. Set retention on the topic long enough to cover recovery from ingester outages, and document the value. The check is that the topic describes with the expected partition count, replication factor and retention, and that partition leaders are spread across brokers.
Configure distributors to write and ingesters to consume
Update the Loki configuration so distributors write incoming log streams to the Kafka topic and ingesters consume their assigned partitions. Use the configuration keys named in the Loki Kafka-based ingestion documentation for your release, and apply the same bootstrap servers and topic name on both sides. Keep the ingester replica count aligned with the partition count and roll the change through a non-production environment first. The check is that distributors report successful produce calls, each ingester reports ownership of a single partition, and no partition is left without a consumer.
Enable authentication and TLS on the Kafka path
The security owner enables TLS for traffic between Loki components and Kafka brokers, and configures an authentication mechanism that Kafka supports, such as SASL with SCRAM-SHA-256 or SCRAM-SHA-512, or SSL client authentication. Grant the Loki distributor and ingester principals only the topic permissions they need, and check the authorization model for your Kafka version, since KRaft clusters restrict resources without ACLs to super users unless the setting is changed. The check is that a connection without credentials or with an unsupported certificate is refused, and the Loki principals can produce and consume on the topic only.
Verify with ingestion tests and Kafka lag checks
Run controlled ingestion tests that push known log volumes through distributors, then query the same entries in Loki to confirm nothing was dropped between the write path and storage. Monitor consumer lag per partition in Kafka and the ingestion and discarded-sample metrics in Loki during the test and after a planned ingester restart. Compare lag returning to baseline after load stops, and confirm that a restarted ingester resumes from its committed offset. The check is that every test record is queryable, lag drains within the period you set in your runbook, and alerts fire on sustained lag. Keep this test in the runbook for each upgrade.
Securing the Kafka path and protecting log data
Kafka sits between Loki distributors and ingesters, so it holds unencrypted-by-default log records in transit and at rest until ingesters consume them. The cards below cover the controls that protect that path: how clients authenticate, who may touch topics, how tenant identity survives the buffer, how stored data is retained, and how the broker stack is kept patched.
Client authentication with SASL and TLS
Kafka authenticates clients, brokers and tools with SSL or SASL, and TLS protects traffic between them. The documented SASL mechanisms are GSSAPI (Kerberos), PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER. Security is optional in Kafka, so a cluster can run with unsecured or mixed listeners. Confirm that every listener used by distributors and ingesters requires authentication and encryption, and that no plaintext listener is left open for convenience. Choose the mechanism your identity provider supports and plan how credentials reach Loki's configuration.
Kafka security overviewACLs in KRaft clusters
In KRaft clusters the StandardAuthorizer stores ACLs in the cluster metadata log. Resources without ACLs are restricted to super users unless allow.everyone.if.no.acl.found is set to true. Keep that setting false on the Loki topic path so only the distributor's producer principal can write and only the ingesters' consumer group can read. Review super user membership, because it bypasses ACLs, and confirm that the consumer group permissions match the partition assignment you planned.
Kafka authorization docsLog data at rest and retention
Log records written to a Kafka topic are stored on broker disks until retention removes them, so anything a tenant sent to Loki exists in Kafka too. Kafka's own documentation does not make encryption at rest a default you can assume, so confirm whether your storage layer or volume encryption covers broker disks. Set topic retention to the shortest period that still covers ingester recovery, and document it as a data flow in your privacy records, since Loki's retention does not clean up Kafka copies.
Tenant headers carried through records
Loki identifies tenants with the X-Scope-OrgID header when auth_enabled is true. The distributor must place tenant identity in the record so ingesters write each stream to the correct tenant after consumption. Test this with two tenants sending to the same topic and confirm that a record from one tenant cannot be written under another's ID. Note that any consumer able to read the topic can see every tenant's records, so topic read access is a tenancy control, not only an operations one.
Loki multi-tenancy docsPatching and Java for Kafka 4.x brokers
Kafka 4.0 supports only KRaft mode, so ZooKeeper-based clusters must migrate to KRaft before upgrading to 4.x. Brokers require Java 17 from Kafka 4.0 onward, while clients need at least Java 11. Kafka recommends that KRaft clusters older than 3.3.x move to 3.9.x before 4.x. Rolling upgrades are supported from each release in the past year to the latest version. Plan Java and Kafka upgrades as separate change windows, and confirm the supported release line on the downloads page before each patch cycle.
Kafka upgrade notesWhat running Kafka alongside Loki adds to operations
Adding Kafka to the Loki write path means operating a second distributed system with its own upgrade, backup and monitoring obligations. The team that owns Loki will need to own Kafka brokers, topics and their storage as well, or agree on a clear owner before the design is approved. Kafka's own lifecycle sets the cadence: the project aims for three releases a year, and rolling upgrades are supported from each release in the past year (the last three releases) to the latest version. The Kafka downloads page lists 4.3.1, 4.2.2 and 4.1.2 as the supported releases, and brokers require Java 17 since Kafka 4.0. Confirm which Java runtime your broker images and hosts provide before you pick a Kafka line, and plan a recurring upgrade window rather than an occasional project.
Monitoring grows too. Consumer lag per ingester partition and broker disk usage become new signals that belong in alerting next to Loki's own ingestion metrics. A lag alert tells you that ingesters are falling behind the distributors, and a disk alert tells you that retention on the topic is not keeping pace with write volume. Decide early which thresholds page on-call and which only open tickets, and check that the metric names you alert on match the Loki release you run, since the experimental configuration and metric names may change. Backups also change shape: Kafka topics are a buffer, so the question is how much unprocessed data you accept losing during a broker failure, and whether that matches the retention your Loki tenants expect.
The most important operational consequence is that a Kafka outage becomes a Loki ingestion outage. When brokers are unavailable, distributors cannot write streams and ingesters cannot consume partitions, so log shippers see failed writes even though Loki's query path may still be healthy. Before go-live, rehearse a broker loss, a partition leader change and a full cluster restart while senders are pushing logs, and record how quickly ingestion resumes. Ask your Kafka operator for the replication factor, minimum in-sync replica settings and the alert that fires when a partition loses replicas, and check that your sender retry behavior will not drop logs during that window.
Limits to confirm before you commit
Kafka between distributors and ingesters adds a stateful system with its own versions, licenses and failure modes. The cards below cover the checks that decide whether this pattern fits your Loki version, your Kafka estate and your retention rules.
Experimental status
Kafka-based ingestion is documented as experimental, and its configuration options and metric names may change between releases. Treat the Kafka path as a decision you revisit at each Loki upgrade, not a one-time setup. Before go-live, confirm which keys and metrics your dashboards and alerts depend on, and pin the Loki version so a change does not reach production unannounced. Plan for a configuration review at every upgrade.
Loki Kafka docsLoki version and release notes
Check that the Loki release you run includes the Kafka ingestion path in the form you need, and read its release notes for changes to the ingester, distributor and partition handling. The latest published Loki release listed on GitHub is v3.7.8, published September 17, 2026, but confirm the release that fits your upgrade plan. Ask whether the Kafka path has known gaps for your deployment mode, since simple scalable mode is being deprecated.
Loki releasesKafka version and upgrade path
Kafka 4.0 supports only KRaft mode, so ZooKeeper-based clusters must migrate to KRaft before upgrading to 4.x. KRaft clusters older than 3.3.x should move to 3.9.x first. Confirm the Kafka version you will run against the supported releases list, the Java 17 broker requirement and your rolling upgrade window, because the Loki ingestion path depends on a Kafka version your team can keep patched.
Kafka upgrade notesRedpanda license terms
Redpanda speaks the Kafka protocol, so it can be a candidate broker, but its core is under the Business Source License and its enterprise features, including tiered storage, audit logging and role-based access control, need a paid license key. Before choosing it, have legal review the BSL terms against your intended use, and confirm which controls your security review requires. Ask what happens to features when a license expires.
Redpanda licensing overviewSizing and throughput testing
Partition count, broker sizing and ingester consumption rate determine whether the buffer keeps up with peak log volume, and none of these should be assumed from a vendor figure. Each ingester consumes one partition, so partition layout must match your ingester count and stream distribution. Run a load test with your own log shape, including bursts and an ingester restart, and measure consumer lag before you size the production cluster.
Replay retention versus Loki retention
Kafka keeps records for its own retention period, which is separate from the retention Loki applies to chunks and index in object storage. Loki retention is applied by the compactor and is disabled by default, so logs persist until you enable it. Decide how long replay data must survive for recovery, set the Kafka topic retention to match, and document that retention for auditors so buffered copies of logs are governed by the same rules as stored ones.
Loki retention docsQuestions buyers ask before adding Kafka to Loki
Is Kafka-based ingestion for Loki ready for production use?
Treat it as experimental. The Loki documentation says the feature is experimental and that its configuration options and metric names may change, so a production decision should rest on a tested version pinned in your change process. Confirm the exact Loki version you plan to run, read the current Kafka-based ingestion documentation for the options it supports, and ask whether the upgrade path for your chosen version has changed those options. Your risk review should cover what happens to ingestion if the buffer or the consumer lag is unhealthy, and whether your team accepts operating a feature whose settings may change between releases.
How much extra work does adding Kafka put on a Loki cluster?
It adds a second stateful distributed system, so the work grows with the number of components you must run, secure, monitor and upgrade. Loki's distributors write streams to a Kafka topic, and each ingester consumes one partition, so partition count, consumer placement and lag monitoring all become part of the design. The main drivers are how many partitions you plan, how Kafka is hosted (in your existing estate or new), the authentication and TLS model, and how often you expect to upgrade both products. Kafka itself is licensed under Apache-2.0 with no paid edition from the project, so the cost is mainly staff time and infrastructure, not license fees.
Can our own platform team run Kafka beside Loki without outside help?
Yes, if your team already runs Kafka in production and has the skills to size topics, secure listeners and handle rolling upgrades. The Kafka project ships three releases a year and supports rolling upgrades from releases within the past year, so someone must own that cycle. Teams new to Kafka should expect a learning curve around KRaft mode, ACLs and partition planning. A useful internal test is whether you can recover a broker or a stuck consumer group during a drill without improvising. Many teams split the work: internal staff own day-to-day operations while an outside team builds the first version and documents it.
How long does a typical Kafka buffer setup for Loki take?
Duration depends on the scope you agree, not on a standard number, and no duration is set by the supplied sources. The main drivers are whether Kafka already exists in your environment, the security model you require (SSL, SASL mechanisms and ACLs), the partition and retention design, the monitoring you need before go-live, and how much load testing you run. Ask for a timeline that lists each phase, the access you must grant, and the test traffic you will supply. Confirm with your Kafka and Loki owners how long their change windows take before you commit to a date.
What does the client need to provide for this work?
Plan to provide access and inputs in four areas: the infrastructure where Loki and Kafka will run (cloud accounts, clusters or data center hosts), credentials or approval paths for changes, people who know your Kafka and Loki standards, and representative test traffic. Test traffic matters because partition count and consumer behavior depend on real stream volume and label patterns. Your team should also confirm the Java runtime requirements for the Kafka version chosen, since Kafka 4.0 and later require Java 17 for brokers. Ask the provider to list these inputs in the statement of work so gaps show up before the build starts.
What determines the price of a fixed-scope quote for this work?
A fixed-scope quote follows from the written scope, so the details that move it are the ones you define up front: how many Loki environments and clusters are in scope, whether Kafka is new or existing, the security controls required, the test and validation depth, the documentation and handover expected, and any ongoing support you want after go-live. DeployOpen does not publish a price list, and each quote is built from the agreed scope. Ask for deliverables, assumptions, client responsibilities and change handling in writing, so that a later requirement can be priced as a separate change rather than quietly absorbed.
Should we choose Redpanda instead of Apache Kafka as the buffer?
That choice depends on licensing, operating model and which features you need, and the Loki documentation for this topic is written around Kafka. Apache Kafka is Apache-2.0 licensed with no paid edition from the project. Redpanda's core is under the Business Source License, which restricts offering Redpanda as a commercial streaming service, while its enterprise features need a paid license key and some capabilities such as tiered storage and audit logging sit behind that license. Confirm with your legal and procurement teams which license terms fit your use, and test compatibility with the Loki settings you intend to use before you decide.
How DeployOpen scopes and delivers a Kafka-buffered Loki
DeployOpen treats a Kafka write buffer as a design decision to make before the build starts, not a default to add later. We scope whether the buffer is justified for your ingestion path, then build, test, document and hand over the Loki and Kafka pieces together, so your team can run both with clear ownership.
How we scope
- We confirm the ingestion problem the buffer would solve, using your current log volumes, sender behavior and recovery needs.
- The written scope lists the Loki and Kafka components, the topic and partition plan, the target environment and the features that remain experimental.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts, and a quote follows from that scope.
How we build
- We deploy the Kafka cluster and the Loki distributor and ingester configuration in your infrastructure, matching versions to the documented compatibility notes.
- We set up authentication, TLS and Kafka ACLs so distributors and ingesters reach only the topics and consumer roles they need.
- We test failure paths, including an ingester restart and a broker outage, and record the observed behavior before go-live.
How we hand over
- You receive configuration, partition and topic layouts, runbooks for Kafka and Loki, and the metrics and alerts we set up for lag and ingestion.
- We walk your platform and operations engineers through the upgrade, retention and recovery procedures for both systems.
- Handover notes flag which Loki Kafka options may change because the feature is experimental, so your team knows what to recheck at each upgrade.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer covering both the Loki and Kafka layers.
- Support covers reviewing Kafka version changes, tracking Loki release notes and planning upgrades before they reach production.
- Retesting after configuration changes or scaling events confirms that buffering, consumption and recovery still behave as documented.

