Migrating Loki to Kafka-based ingestion

Moving a running Loki cluster from the direct write path to Kafka is possible only through the method Grafana Labs has tested, which needs a second full ingester group and carries experimental support status. This page explains the method, the capacity it consumes and what to plan before you start.

On this page

What migrating Loki to Kafka-based ingestion involves

Moving a running Loki cluster from the direct gRPC write path to Kafka is a side-by-side migration that needs capacity for a second full ingester group. Kafka-based ingestion is experimental in Loki, and Grafana Labs provides no engineering support, on-call support or SLA for it, so the risk of running it sits with your team unless you contract separately. The reader's situation is a cluster where distributors send writes straight to ingesters, and the goal is to insert Kafka or a Kafka-protocol-compatible system such as WarpStream as a durable buffer between them.

The effort scales with three things: the size of the existing cluster, the Kafka platform you run, and how much spare capacity you can give the migration. The tested method keeps the existing ingesters running while a new set of Kafka-consuming ingesters starts up, so you must have room for a second full-sized ingester group for at least querier.query_ingesters_within, whose default is 3 hours. Confirm that figure against your own configuration before you size anything, because the duration you need depends on how far back queries reach into ingester memory. Your own platform and operations team can carry out this work, but they should plan the parallel run, the cutover and the rollback path before touching production writes.

Kafka itself is an Apache Software Foundation project under the Apache License 2.0, so the broker software carries no license fee, but you still pay for the brokers, storage, networking, TLS and SASL setup, monitoring and the people who operate them. Before you start, check the Kafka release you plan to run against the Apache Kafka downloads page and confirm that your Loki version supports the ingestion path you choose. Ask your Loki and Kafka operators to write down who is on call for the parallel run and who makes the call to roll back.

Which parts of the current write path carry over to Kafka ingestion

This table compares each part of a running Loki write and read path with its position under Kafka-based ingestion. Read each row as three questions: what stays the same, what gains a Kafka dependency, and what you must decide before starting. The main takeaway is that Kafka changes the write path between distributor and ingester, so most storage, retention and access settings carry over, but capacity planning and the experimental status need explicit decisions.

ComponentDirect gRPC write path (today)Kafka-based path (experimental)Decision for your cluster
Distributor roleReceives pushed log streams, validates them and forwards them directly to ingesters over gRPCStays in front of the cluster but writes to Kafka instead of ingesters, which is the new durable bufferConfirm the distributor configuration changes in the Loki migrate to Kafka guide before editing production values
Ingester roleReceives streams directly, builds chunks and flushes them to object storageStays unchanged in function but consumes from Kafka, and a separate set of Kafka-consuming ingesters runs beside the existing onesDecide how the two ingester groups are named, scheduled and scaled during the transition
Kafka or compatible bufferNot presentNew dependency: Apache Kafka or a Kafka-protocol-compatible system such as WarpStream sits between distributor and ingesterChoose the platform, topic layout, partition count and retention, and who operates it
Object storage and indexChunks and index are written to object storage by ingestersUnchanged target: chunks and index still land in the same object store and index configurationConfirm that the index schema and period_config need no change for your Loki version
Queriers and query_ingesters_withinQueriers ask ingesters for recent data within query_ingesters_within, default 3 hoursQueriers still read recent data from ingesters, so the window applies to the new ingester group as wellPlan capacity for a second full-sized ingester group for at least the query_ingesters_within window
Retention and compactorCompactor applies retention only when retention_enabled is set, and it is disabled by defaultCompactor behavior is unchanged, but Kafka retention is a separate setting that must not be confused with log retentionKeep log retention in Loki config and Kafka message retention separate, and document both
Tenant headers and authenticationTenants are identified by X-Scope-OrgID when auth_enabled is true, and the authenticating reverse proxy sits in front of LokiHeaders are still set at the distributor, while Kafka adds its own client authentication such as SASL or SSLDecide how Kafka clients authenticate and which ACLs grant access to the Loki topics
Grafana data sourcesGrafana points at the Loki query endpoint, and dashboards use existing LogQL queriesNo change expected for query endpoints, since reads still go through the query pathTest existing dashboards and alerts against the migrated cluster before cutover

How the Kafka buffer sits between distributor and ingesters

Clients still write to the distributor, but during the parallel run the distributor also publishes to a Kafka topic that a new set of Kafka-consuming ingesters reads from. The existing ingesters keep serving the direct gRPC path, and queriers read from both ingester sets until the old set can be retired. Check that both groups write to the same object storage, that queriers reach both sets, and that you have capacity for the second full ingester group for at least the query window.

Existing and Kafka-consuming ingester sets run side by side during migration.

Documented sources and components for the migration

The migration rests on one tested Grafana Labs path and a small set of Apache Kafka documents that govern versions, Java, KRaft and access control. Read the Loki guide first, then use the Kafka documents to choose and secure the broker layer your Loki cluster will write through.

Loki migrate to Kafka guide

This is the only migration path Grafana Labs has tested, and it is the baseline for the whole project. It describes running existing ingesters and a new set of Kafka-consuming ingesters side by side, which is why capacity for a second full-sized ingester group matters. Confirm the guide's version against the Loki release you run, and confirm the querier.query_ingesters_within value your cluster uses, since the overlap period depends on it. Treat the feature as experimental: the guide does not give you engineering or on-call support.

Default query overlap
3 hours
Loki Kafka guide

Apache Kafka downloads page

The downloads page lists the supported Kafka releases and marks older versions as archived, so it is the starting point for choosing a broker version. Pick a release that is still supported at the time of your build and plan a path to the next one. Confirm with your own team which Kafka distribution and support contract applies, because the project itself offers no paid edition. Check the page again just before you install, since bugfix releases are issued only for supported lines.

Latest listed release
4.3.1
Kafka downloads

Kafka time-based release plan

This plan explains the release cadence and which upgrade paths the project supports, including rolling upgrades from each release in the past year to the latest version. It matters for Loki because the Kafka cluster becomes a durable buffer that your ingesters depend on, so an unplanned broker upgrade can stall writes. Use it to set your own upgrade window and to decide how far behind the current release you are willing to run. Confirm your upgrade cadence against your change-control process.

Release interval
4 months
Release plan

Kafka upgrade notes for KRaft and Java

These notes set the runtime prerequisites for the broker layer. Since Kafka 4.0, only KRaft mode is supported, so any ZooKeeper-based cluster must migrate first, and clusters older than 3.3.x should reach 3.9.x before moving to 4.x. Brokers require Java 17, while clients require at least Java 11. Check which client libraries your Loki build uses, and confirm the JVM your broker hosts run, before you schedule the work.

Kafka upgrade notes

Kafka security overview

This overview covers how clients, brokers and tools authenticate and encrypt traffic. Kafka supports SSL and SASL, with mechanisms including GSSAPI, PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER. Security is optional in Kafka, so you must decide which listeners are encrypted and which mechanism Loki's ingesters and distributors will use, and confirm that your chosen client configuration supports it. Avoid leaving any listener unsecured on a shared network.

Security overview

Kafka authorization and ACLs

The authorization documentation explains how the StandardAuthorizer stores ACLs in the KRaft metadata log and how resources without ACLs are handled. Unless allow.everyone.if.no.acl.found is set to true, resources without ACLs are restricted to super users, which can block Loki's writers and readers if you forget to grant them. Write ACLs for the Loki ingester consumer group and the topic before the first cutover. Confirm the principal names your authentication mechanism produces.

Authorization and ACLs

WarpStream as a Kafka-compatible option

The Loki guide names WarpStream as a Kafka-protocol-compatible system that can serve as the durable buffer, so you do not have to run Apache Kafka brokers yourself. Its operating model differs from self-managed brokers, so the cluster's storage, networking and access controls need separate review. The Loki guide does not give a compatibility matrix, so confirm with the vendor which Kafka protocol features the Loki client path uses and whether your deployment model fits your infrastructure requirements.

How the parallel run and cutover sequence works

The sequence moves a running Loki cluster from direct gRPC writes to Kafka by standing up a second ingester group beside the current one, verifying both paths, and retiring the old ingesters only after queries no longer depend on them. Each phase ends with a documented check before the next begins.

  1. Inventory the current write path

    The Loki platform owner records the running version, deployment mode, ingester replica count, persistent volume layout, object storage and index configuration, tenant list, and any per-tenant limits. Platform and storage teams confirm which components depend on the ingesters directly, including dashboards, ruler rules and alerting that query recent data. The step closes with a written baseline that the later checks compare against.

  2. Check capacity for a second ingester group

    The team sizes a full second ingester group, because the tested method runs the existing ingesters and the Kafka-consuming ingesters side by side. Capacity must hold both groups at once for at least the querier.query_ingesters_within window, which defaults to 3 hours in the Loki guide, plus any buffer the team sets for recovery. The step closes when the cluster owner signs off on node, memory, disk and network headroom with a reviewed quota for the second group.

  3. Set up Kafka and topic access control

    Platform engineers deploy Kafka or a Kafka-protocol-compatible system and create the topic that Loki will use, sized for the partitions and retention the team chose. They configure TLS and a SASL mechanism for the Loki clients, and set authorization so only the Loki distributor and ingester identities can produce or consume. Because the Kafka authorizer denies resources without ACLs by default, the team verifies each permission with a test produce and consume before continuing. The step closes with a passing access test for every Loki identity.

  4. Deploy the Kafka-consuming ingester set

    The team deploys the new ingester group with Kafka ingestion enabled, using its own ring or identifiers so it does not join the existing group's write path. The existing ingesters keep receiving direct writes during this phase. The step closes when every new ingester is healthy, consuming from the expected partitions, and reporting no consumer lag that keeps growing.

  5. Verify reads and writes across both sets

    Operators send test streams and confirm that they are queryable from both the old and new ingester sets, while queriers read recent data from both paths. They compare ingestion error rates, query latency and ruler results with the baseline from the first step. Parallel operation continues until queries are served correctly through the window set by querier.query_ingesters_within. The step closes with recorded test results and no unexplained gaps or duplicate series.

  6. Shift write traffic to Kafka

    The team moves write traffic from the direct gRPC path to the Kafka-backed path, typically in stages by tenant or environment so each change can be reverted. Operators watch lag, error rates and per-tenant limits after each stage. The step closes when all tenants write through Kafka and the team has a tested rollback that returns writes to the old ingesters.

  7. Decommission the old ingesters

    The old ingesters are scaled down only after the querier window has passed with no queries requiring their data, and after the team confirms that data flushed from them is readable from object storage. The team removes the old ingester deployment, its ring entries and its capacity reservation, then updates runbooks and monitoring. The step closes when the cluster runs only the Kafka-consuming ingesters and the baseline checks pass again.

Why a second full ingester group changes the capacity plan

The tested migration method needs capacity for a second full-sized ingester group, not a partial one. During the overlap, the existing ingesters keep serving writes and queries while a new set of Kafka-consuming ingesters starts up beside them. The new group must stay up for at least querier.query_ingesters_within, which defaults to 3 hours, because queriers keep asking ingesters for recent data until that window has passed. Sizing the new group at half the current footprint, or planning to shrink the old group early, takes the method outside what Grafana Labs has tested. Confirm the exact value in your own configuration, since a non-default setting changes how long the duplicate capacity must run.

For compute and memory, the practical effect is that your peak ingester footprint roughly doubles for the length of the overlap. Ingesters hold recent chunks in memory and write them to local disk before flushing to object storage, so the new group needs its own memory headroom and its own write-ahead space on disk. Plan node placement so the new ingesters can schedule without evicting existing workloads, and check whether your cluster has enough nodes with the right zone and anti-affinity constraints to host both groups. Object storage write load also rises during the overlap as both groups flush chunks and index data, so review request rates and bucket limits with your storage provider before cutover.

Before committing to a plan, measure what the current ingesters actually use. Pull memory, CPU, disk usage and flush rates for the write path from your own monitoring over a representative period that includes your daily peak. Use the resource and sizing guidance in the Loki documentation to translate those measurements into the second group's requests and limits, and treat the Kafka cluster's own capacity as a separate line item. Ask your team to confirm the ingester replica count, chunk and flush settings, and the overlap duration in writing. These numbers should come from your environment, not from an estimate in this guide.

Choosing the Kafka platform behind the buffer

Apache Kafka is an Apache Software Foundation project released under the Apache License 2.0 (SPDX: Apache-2.0), and the project itself offers no paid edition. Your organization carries the full operating load: broker capacity, storage, monitoring, patching and upgrades. The supported releases listed on the downloads page are 4.3.1, 4.2.2 and 4.1.2, and rolling upgrades are supported from each release in the past year (the last three releases) to the latest version. Apache 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.

  • Operating responsibilities: You size brokers, disks and replication, run upgrades inside the supported window, and staff on-call for broker failures. Kafka's cost is mostly staff time and storage that recur every month.
  • Security setup: Kafka supports SSL/TLS for traffic between clients, brokers and tools. Authentication uses SSL or SASL, with GSSAPI (Kerberos), PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER as the documented SASL mechanisms. Security is optional, so you must configure listeners deliberately rather than assume they are protected.
  • ACL behavior in KRaft: 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, so Loki's client principal needs explicit write and describe grants on its topic.
  • Upgrade planning: KRaft clusters older than 3.3.x should move to 3.9.x before 4.x, so check your current version before you schedule any change.

Before choosing this option, confirm which team owns Kafka on-call, which Java runtime your hosts support, and whether your security team accepts the SASL mechanism you plan to use.

What drives the effort and cost of the migration

This table lists the factors that change how much a move to Kafka-based ingestion costs and how long it takes, with what raises effort and what to request in a quote. Read each row against your own cluster and Kafka situation, since the cost of a second ingester group and an unfamiliar Kafka platform usually dominate the total.

DriverWhat raises effortWhat to ask for in a quote
Cluster size and ingest volumeLarge ingest rates, many ingesters, and high stream counts increase the size of the parallel group and the amount of data replayed through Kafka.A sizing estimate for a second full ingester group, with the assumed daily volume and the cloud capacity it needs.
Spare capacity for a second ingester groupThe tested method needs capacity for a second full-sized ingester group for at least querier.query_ingesters_within (default 3 hours). Tight headroom forces a larger capacity purchase or a maintenance window.Who provisions the extra capacity, whether it is billed by your cloud account or your data center team, and how it is released after cutover.
Kafka platform choice and existing KafkaRunning a new Kafka cluster means licensing-free software but new hosting, operations and skills. Using a Kafka-protocol system such as WarpStream adds a vendor relationship and its own bill. Existing shared clusters need capacity review and change approval.Whether the work covers a new cluster or an existing one, the platform's own fees (if any), and the hosting and staff time each option assumes.
Kafka version and upgrade workApache Kafka 4.0 supports only KRaft mode. A ZooKeeper-based cluster must migrate to KRaft first, and clusters older than 3.3.x are advised to reach 3.9.x before 4.x. Each step adds testing and downtime planning.Current Kafka version and mode, the upgrade path proposed, and whether the quote includes the upgrade or assumes a ready cluster.
Security integration (TLS, SASL, ACLs)Mutual TLS, a SASL mechanism such as SCRAM or OAUTHBEARER, and ACLs in the KRaft StandardAuthorizer all need configuration on both Loki and Kafka. Missing ACLs can block access unless allow.everyone.if.no.acl.found is set, which needs a security decision.Which SASL mechanism and certificate source are used, who manages credentials, and how ACLs for the Loki principals are written and tested.
Topic design and retentionPartition count, replication factor and retention must match write rate and the replay window. Changing partitions later is harder than sizing them correctly at the start.Proposed topic names, partition and replication settings, retention period, and the sizing assumptions behind them.
Parallel-run durationBoth ingester groups run side by side until cutover. Longer parallel runs cost more capacity and more monitoring attention.The planned parallel-run length, the exit criteria, and the capacity cost assumed for that period.
Monitoring and rollback planningRollback needs defined steps for returning writes to the direct path, plus dashboards for Kafka lag, ingester health and ingestion errors. Each missing signal adds investigation time during cutover.The metrics and alerts delivered, the documented rollback procedure, and whether rollback is tested before production cutover.
Team Loki and Kafka experienceTeams new to Kafka operations or to Loki internals need more training, review and support time. Experimental status means the team carries more of the operating risk.Named roles on the client side, the training or pairing included, and what support is available after cutover.

What usually goes wrong with Kafka-based ingestion and how to prevent it

Most problems in a Kafka-based Loki migration come from treating an experimental path like a routine upgrade. The cards below cover the support model, capacity, overlap timing, Kafka access, topic sizing and rollback, with the check and the evidence to keep for each.

Experimental status without support

Kafka-based ingestion in Loki is experimental, with no engineering or on-call support and no SLA. Decide before the change window opens who will diagnose a stalled consumer at night and what the fallback is if Grafana Labs' tested path does not behave in your environment. Record the owner, the escalation route and the accepted risk in the change ticket, and confirm with your own vendor or partner what support, if any, covers your deployment.

Support status
Experimental
Migrate to Kafka guide

Undersized second ingester group

The only tested method runs a full second ingester group beside the existing one, so capacity must be planned for two complete sets at once. Count CPU, memory, disk and any zone or replica layout for the new group, not just the ingester pods you plan to add. Ask your platform team to confirm the node headroom and storage quota before cutover, and keep the capacity calculation and the node usage graphs from a dry run as evidence.

Default query_ingesters_within
3 hours

Overlap window that ends too early

Queries still need data held by the old ingesters for the duration of querier.query_ingesters_within, which defaults to 3 hours. If you retire the old ingesters before that window has passed, recent logs disappear from query results even though nothing failed. Keep both groups running for at least that period plus a safety margin, and verify with a known test log line that it is queryable from the new path before you scale anything down.

Kafka ACL lockouts

In KRaft clusters, the StandardAuthorizer treats resources without ACLs as restricted to super users unless allow.everyone.if.no.acl.found is set to true. Loki's producers and consumers can therefore be refused access the moment a topic is created, even though the topic exists and the brokers are healthy. Create the principals and topic ACLs for Loki's distributors and ingesters before pointing any traffic at the topic, and test both produce and consume from the Loki service accounts.

Kafka authorization docs

Topic retention and partition sizing

If topic retention is shorter than the time a consumer group may need to catch up after an ingester restart, unread records are deleted before Loki reads them, and logs are lost. Too few partitions limit how many ingesters can consume in parallel, so lag grows during bursts. Set retention to cover your worst realistic recovery time, size partitions against peak throughput, and keep consumer lag and retention settings in your runbook with the values you tested.

Missing rollback steps

A cutover without written rollback steps leaves the team improvising when lag or query gaps appear. Document how to return distributors to the direct write path, which configuration keys change back, how the old ingester group is kept ready, and who approves the switch. Rehearse the rollback in a non-production environment and keep the rehearsal log, the signed-off steps and the time each step took as evidence for the change record.

Questions teams ask before moving Loki to Kafka

Is Kafka-based ingestion in Loki production ready?

Not by Grafana Labs' own definition. Kafka-based ingestion is experimental, with no engineering or on-call support and no SLA, so the team carries the operational risk. That status does not make the work unsafe, but it changes who answers when something breaks. Before committing, confirm the current status in the Loki migration guide against the Loki version you run, and decide whether your organization accepts an experimental data path for logs it must retain. Compliance and incident-response owners should sign off on that decision in writing.

How much extra capacity does a second ingester group need, and how long does the overlap last?

The only migration path Grafana Labs has tested runs your existing ingesters and a new set of Kafka-consuming ingesters side by side. That means capacity for a second full-sized ingester group, not a small canary. The overlap must last at least querier.query_ingesters_within, which defaults to 3 hours, because queries still need the old ingesters' recent data during the switch. Drivers of the real figure include your daily ingest volume, retention of in-memory data, and the headroom your cloud or data center can provide. Ask your platform team to size the second group against current peak ingest before scheduling.

Can our own team do the migration without outside help, and what skills does it need?

Yes, if the team already runs Loki in production and has the skills below. The work spans Loki configuration, Kafka operations, and capacity planning, and an error in the cutover can affect log availability. Skills to check include Loki ingester and querier behavior, Kafka topic design, TLS and SASL configuration, and rollback under load. Kafka expertise matters most, because the buffer becomes a new dependency that must stay available. A partner can plan and implement the work under a written scope, but the decision to use an experimental path remains yours.

What does the migration require from our infrastructure and security teams?

Infrastructure teams provide the second ingester group, network paths between distributors, Kafka and ingesters, and monitoring for the new components. Security teams review how Kafka authenticates clients and brokers. Kafka supports SSL and several SASL mechanisms, including SCRAM-SHA-512 and OAUTHBEARER, and security is optional, so the team must choose and enforce it rather than inherit it. Authorization in KRaft clusters is controlled by ACLs in the metadata log, and resources without ACLs are limited to super users unless allow.everyone.if.no.acl.found is set. Confirm each setting against the Kafka security overview and the authorization documentation.

What drives the cost of this work, and what should we ask for in a quote?

Cost comes from three parts: the infrastructure for the second ingester group and the Kafka cluster, the labor to design, build and test the change, and the ongoing operation of Kafka. Infrastructure cost recurs while the overlap runs and after, if the buffer stays. Labor is one-time for the migration but may recur through a support retainer. Costs rise with daily ingest volume, the number of topics and partitions, the number of environments, and the amount of testing required. Ask for a written scope listing deliverables, environments covered, the rollback plan, what is excluded, and which parts are one-time versus recurring. DeployOpen does not publish prices; a quote follows from the agreed scope.

Can we use WarpStream instead of Apache Kafka?

Loki's documentation says Kafka or a Kafka-protocol-compatible system such as WarpStream can serve as the durable buffer. The choice affects the operating model, licensing, and where data is stored, so it should be a deliberate decision rather than a default. Apache Kafka is licensed under Apache-2.0 and has no paid edition from the project itself, and its supported releases are listed on the downloads page. WarpStream is a separate product with its own terms and support model. Confirm the compatibility level of the exact version you plan to use with Loki, and confirm the vendor's support and data location terms before choosing it.

What does a rollback look like if the Kafka path misbehaves?

A rollback returns ingestion to the original direct write path while the existing ingesters are still running, which is why the side-by-side design matters. Plan the rollback before the cutover: define the signals that trigger it, such as ingestion lag, dropped writes or query gaps, and the steps to redirect distributors. Keep the original ingester group until queries have been verified against the new path and the overlap window has passed. Once the old group is removed, a rollback becomes a rebuild, so confirm the retirement date in writing. Test the rollback in a non-production environment and record how long it takes.

How DeployOpen scopes and delivers a Loki Kafka migration

DeployOpen plans the move of a running Loki cluster to Kafka-based ingestion as a fixed-scope engagement inside your own infrastructure. The work starts with an inventory of current ingesters, capacity and topic requirements, and it stays inside the side-by-side method Grafana Labs has tested.

How we scope

  • Inventory the current Loki version, deployment mode, ingester sizing and write volume before any change is proposed.
  • Confirm capacity for a second full-sized ingester group that stays available for at least the query ingester lookback window.
  • Agree in writing whether Kafka or a Kafka-protocol system such as WarpStream will be the buffer, and who operates it.

How we build

  • Stand up a test Loki cluster with Kafka-consuming ingesters running beside the existing write path before touching production.
  • Define topic partitioning, retention and Kafka authentication and authorization settings against your security baseline.
  • Run write and query tests, then record ingestion lag, consumer behavior and rollback steps for each stage.

How we hand over

  • Deliver the configuration, topic setup, runbooks and the cutover and rollback plan as written documentation.
  • Walk your platform and on-call teams through dashboards for ingestion lag, consumer health and ingester memory.
  • Record the experimental support status of Kafka-based ingestion so your risk owners sign off on it knowingly.

How we support

  • Offer ongoing support, Loki and Kafka upgrades and continuous testing as a retainer after handover.
  • Plan Kafka version upgrades against the supported releases your cluster will run, with each upgrade tested first.
  • Ask your DeployOpen contact to confirm which parts of the experimental feature your own engineers will own after go-live.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.