Ingesting Kafka topics into OpenSearch with Data Prepper

Kafka ingestion into OpenSearch runs through Data Prepper's kafka source and buffer. This page covers what to plan, how to configure it, and where backpressure and access control fail.

On this page

Kafka ingestion into OpenSearch with Data Prepper: what it does

A team that already runs Apache Kafka for application events and wants logs buffered before they reach OpenSearch can place Data Prepper between the topics and the index. The Data Prepper kafka source reads records from one or more Kafka topics through the Kafka Consumer API, so the pipeline pulls events at its own pace instead of accepting pushes from every producer. The kafka buffer type is an alternative to the bounded blocking buffer, and it moves the in-flight queue out of Data Prepper's memory and into a Kafka topic that the team already operates.

This page covers the decisions that come with that design: how the kafka source is configured for bootstrap servers and consumer groups, when Amazon MSK changes the connection settings, how the kafka buffer differs from the blocking buffer, and how to size partitions and consumers so backpressure stays visible instead of silently filling disks. It also covers the Kafka side of the work, including the KRaft requirement for Kafka 4.x, client authentication with SSL or SASL, and the authorization needed for the pipeline's consumer identity. Parsing and routing inside the pipeline belong to the log ingestion section, and cluster-level tuning belongs to the operations pages.

Before you start, confirm which Kafka release your brokers run and whether they use KRaft or ZooKeeper, because the upgrade path to Kafka 4.x depends on it. Confirm also which listeners and authentication mechanisms the brokers expose, since the Data Prepper pipeline must match them exactly. These checks determine whether the pipeline needs a bootstrap server list, MSK-specific settings, or only a credentials and TLS configuration, and they set the ground for the sizing questions later on this page.

Prerequisites for a Data Prepper Kafka pipeline

A Data Prepper Kafka pipeline depends on four systems agreeing with each other: the OpenSearch cluster, the Data Prepper runtime, the Kafka cluster and the network and certificates between them. Check each one before writing pipeline configuration, because a mismatch usually shows up as consumers that stall rather than as a clear error.

OpenSearch and Data Prepper versions

Confirm the OpenSearch cluster version and the Data Prepper release you plan to run together, and check both against the current maintenance status on the releases page. Version 2 is maintained through the 4.0 GA release, while version 1 reached end of life on May 6, 2025. Pin the Data Prepper image or package version so an upgrade does not change pipeline behavior unannounced.

OpenSearch releases

Supported Kafka release

Choose a Kafka release that is still supported, such as 4.3.1, 4.2.2 or 4.1.2, and confirm it against the downloads page before procurement. Older releases are archived and receive no bugfix releases. Ask your Kafka team which release the cluster runs today, because the upgrade path from an older cluster may need its own planning.

Kafka downloads

KRaft mode and Java runtimes

Confirm the Kafka cluster runs in KRaft mode, since Apache Kafka 4.0 removed ZooKeeper mode and ZooKeeper-based clusters must migrate first. Brokers require Java 17 from Kafka 4.0 onward, while Data Prepper and any client tooling must run on a Java version the Data Prepper release supports. Check both runtimes in the environments where pipelines will run.

Kafka upgrade notes

bootstrap_servers and network paths

Set bootstrap_servers in the kafka source unless you use Amazon MSK, where the MSK options replace it. Confirm that the Data Prepper host or container can reach every broker address the bootstrap list returns, not only the bootstrap hosts. Firewalls, DNS names and advertised listeners are the most common reasons a consumer connects and then stalls.

TLS certificates and SASL credentials

Decide which listener Data Prepper uses, then confirm the TLS certificate chain, the trust store format and the SASL mechanism the listener requires. The documented mechanisms include SCRAM-SHA-512, OAUTHBEARER and GSSAPI. Store credentials in your secrets system and plan certificate rotation before the pipeline goes live.

Topic ownership and ACLs

Name an owner for each topic the pipeline reads and confirm that the Data Prepper client principal has read access to it and to its consumer group. In KRaft clusters, resources without ACLs are limited to super users unless allow.everyone.if.no.acl.found is set to true, so a missing ACL looks like an empty topic. Agree on who approves new topics and consumer groups.

How to configure the Kafka source and buffer in order

This sequence takes a Kafka cluster from topics and access rules through a working Data Prepper pipeline that moves events into an OpenSearch index. Each step ends with a check so the team can confirm the path works before it carries production logs.

  1. Create topics and consumer groups

    The Kafka platform team creates the log or event topics with partition counts and retention they have sized for their ingest volume, then names a dedicated consumer group for the Data Prepper pipeline so its offsets are tracked separately from other readers. Confirm the topic names, partition counts and retention settings with the Kafka administrator before anything else depends on them. The step is done when the topics list in the cluster and the consumer group appears in the group listing, even before any consumer has joined.

  2. Create the Kafka principal and ACLs

    Create a service principal for the pipeline using one of the SASL mechanisms your cluster supports, and grant it read access to the topics and to the consumer group. Kafka's authorization model restricts resources without ACLs to super users unless the cluster is explicitly configured otherwise, so a missing grant shows up as an authorization failure rather than an empty topic. Check the principal's permissions with the cluster's ACL listing tool, and confirm with the Kafka team which authentication mechanism and cluster listener the pipeline will use.

  3. Write the Data Prepper pipeline with the kafka source

    The engineer writes a pipeline definition that names the kafka source, the topics and consumer group, the bootstrap servers (unless the cluster is Amazon MSK, which uses its own connection settings), and the credentials reference for the principal. The pipeline also declares a buffer; Data Prepper offers a Kafka buffer type alongside the bounded blocking buffer, and the choice should follow from where backpressure is expected to build. Validate the YAML against the Data Prepper documentation for your release, then confirm the pipeline starts without configuration errors in the Data Prepper logs.

  4. Connect the sink to the OpenSearch index

    Add an opensearch sink to the pipeline with the cluster endpoint, a dedicated ingest role with write access only to the target index pattern, and the TLS trust settings for the cluster. Create a test index with the mapping the team expects so the first documents land on a known schema. Send a small batch of test records to a test topic, then query the test index for the document count and compare it with the number of records produced. A matching count shows the source, buffer and sink are connected end to end.

  5. Start the pipeline and watch consumer lag

    Start the pipeline against the production topic with the consumer group already in place, and watch the group's lag on the Kafka side while the pipeline catches up. Lag that falls toward zero after a short catch-up period shows the consumer keeps pace with the producers. Lag that grows steadily points to either a slow sink, an undersized buffer or too few partitions for the consumer count, and should be investigated before the pipeline is treated as stable. Record the baseline lag and document count so later changes have a reference point.

  6. Test backpressure before relying on the pipeline

    Simulate a slow or unavailable OpenSearch endpoint in a non-production environment and observe how the buffer fills, how lag grows on the Kafka side, and whether events are delayed rather than lost once the sink recovers. Confirm the producers' retention window on the topic is longer than the longest outage you intend to absorb, because Kafka retains data by retention settings, not by consumer progress. The step is complete when the team has written down the observed behavior and the retention margin they accept.

How consumer groups and partitions set ingestion throughput

Parallelism in this pipeline is capped by the partition count of each topic. Kafka assigns each partition to at most one consumer within a consumer group at a time, so the number of Data Prepper kafka source consumers that can read a topic in parallel is bounded by its partitions. Adding pipeline workers or Data Prepper nodes does not raise throughput past that bound. Before sizing, confirm with your Data Prepper version's documentation how the kafka source's consumer settings, thread count and group_id map onto the topics you list, and check the partition count of each topic against the consumer instances you plan to run. Partitions can be added later, but that changes key-to-partition mapping for keyed events, so set the count with your expected peak and growth in mind.

Offsets record how far a consumer group has read in each partition, and the group commits them as it processes. Commit behavior determines what happens after a restart: records read but not yet committed are delivered again, so the OpenSearch side must tolerate duplicates. Keep the group_id stable for a given pipeline so the group resumes from its committed position, and use a new group name only when you deliberately want to re-read a topic from the start. Confirm in the Data Prepper kafka source documentation which offset reset and commit settings apply to your version, and test a forced restart in a staging environment to see what gets replayed.

Plan group names and partitions together so replays are predictable. Give each pipeline its own consumer group, and never let two unrelated pipelines share one group, because they will split partitions and each see only part of the stream. Name groups after the pipeline and environment, for example logs-prod-ingest, so operators can read lag per group in Kafka tooling. For reprocessing, the safer pattern is a separate group and a separate target index or alias, so a replay cannot overwrite live data or double-count it. Document each group's purpose and owner before go-live, and confirm the retention window on each topic covers the replay you expect to need.

Self-managed Kafka or Amazon MSK for this pipeline

With a self-managed cluster, your team installs, upgrades and secures the Kafka brokers, controllers and their listeners. The Data Prepper kafka source reads from that cluster through the Kafka Consumer API, so the pipeline needs an explicit list of brokers in bootstrap_servers, plus the TLS and SASL settings that match how each listener is secured. Kafka security is optional at the cluster level, so a listener can be plaintext, which is a decision you should make deliberately rather than inherit by default.

  • Bootstrap servers: List the brokers the client should contact first. Confirm the exact key names and accepted formats in the Data Prepper Kafka source reference before writing the pipeline.
  • TLS settings: Match the listener protocol the brokers expose. Certificates for the client must be trusted by the brokers' certificate chain, and rotation needs a plan.
  • SASL mechanisms: Kafka documents GSSAPI (Kerberos), PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER. Pick the one your brokers enable and confirm the matching source options.
  • Credentials location: Store the SASL username and password or keytab in your secrets system, not in the pipeline file in plain text.
  • Authorization: Create ACLs for the consumer group and topics. In KRaft clusters, resources without ACLs are restricted to super users unless the allow.everyone.if.no.acl.found setting is enabled, so a missing ACL shows up as a failed read.

Confirm each option against the Kafka version you run, since the Kafka security and authorization pages describe the broker side of these settings.

Mapping Kafka records, topics and consumer identities to OpenSearch

This table maps each Kafka object to its OpenSearch counterpart, along with the settings you must confirm against the Data Prepper and Kafka documentation before building. Read each row as a decision to record in your design document, not as a default to accept. The main takeaway is that the consumer group, the Kafka ACL and the OpenSearch write role should each be owned by a named identity, so that access can be reviewed in one place.

ElementKafka sideOpenSearch side and what to confirm
Topic to pipelineOne or more topics listed in the kafka source configuration, each read through the Kafka Consumer APIOne pipeline per topic family, with a target index chosen per pipeline. Confirm how the source names topics and whether one pipeline can route several topics safely.
Topic to indexTopic name, which often reflects the producing service or data classIndex names should follow a naming convention agreed with the owning team. Confirm index template settings before the first document arrives so mappings are not inferred from the first record.
Record keyMessage key, which may be null, used for partitioning and orderingDecide whether the key becomes a document ID, a field or nothing. Confirm how the source exposes the key in the event and whether duplicates are possible on replay.
Payload fieldsSerialized value, such as JSON, Avro or plain textConfirm the deserializer and codec the source supports for your format. Map fields explicitly and reject unknown types rather than relying on dynamic mapping.
Consumer group to service identityGroup ID that tracks offsets for each consumerGive the pipeline its own group ID and a dedicated service account. Confirm which group setting the source uses and that offsets survive pipeline restarts.
Kafka ACL to OpenSearch write roleRead permission on the topic and group, granted to the pipeline principalGrant the OpenSearch role write access only to the target index pattern. Confirm in both the Kafka authorization docs and the OpenSearch security roles that the two identities are separate and reviewed.
Authentication principalSASL mechanism or SSL identity used by the pipelineConfirm which SASL mechanism your brokers accept and how credentials are supplied to Data Prepper. Keep secrets out of pipeline files in plain text.

Sizing buffers and consumers for backpressure

Backpressure in this pipeline shows up in three places, and each one needs its own signal. The first is the Data Prepper pipeline itself. With the bounded blocking buffer, the pipeline holds a fixed number of records in memory, so when the OpenSearch sink slows, the buffer fills and the source stops accepting new work. The Kafka buffer changes where that queue lives: records are staged in Kafka topics instead of the Data Prepper heap, so the pressure moves from pipeline memory to broker storage. Confirm which buffer type your Data Prepper version supports and which settings each one exposes in the Data Prepper documentation, because the failure behavior you rely on depends on that choice.

Kafka retention is what absorbs bursts. When OpenSearch cannot keep up, the source topic keeps the backlog as long as the retention settings allow, and consumers catch up later. The planning question is therefore not only how fast the pipeline can index, but how long a slow OpenSearch period can last before the oldest unprocessed records age out of the topic. Set retention from your own worst-case outage window and your broker disk budget, and verify it against the Kafka topic configuration on the brokers you run. Also check consumer group membership: adding consumers beyond the partition count does not add parallelism, so partition count caps how far you can scale the source side.

Watch three signals together. Consumer lag per consumer group shows whether the pipeline is falling behind the topic head and by how much. Pipeline buffer fill shows whether pressure is building inside Data Prepper before records reach Kafka. Indexing rejections in OpenSearch show whether the cluster is refusing bulk requests, which is the point where the pipeline should retry or slow down rather than drop data. Sizing numbers for partitions, buffer capacity, retention and consumer counts must come from load tests run against your own message sizes, index mappings and cluster hardware, not from this page. Ask your team or partner to define the test profile, the pass criteria and the retention target before the first production topic is created.

Securing the Kafka connection and access model

The Kafka topics feeding Data Prepper carry the same data OpenSearch will index, so the transport, client identity, topic permissions and OpenSearch roles need to be planned together. Each card below is a control point to design and verify before the pipeline goes live.

Confirm TLS on every listener

Kafka security is optional, so a cluster can run unsecured or mix secured and unsecured listeners. Check each broker listener that Data Prepper will reach and confirm it uses SSL/TLS, not a plaintext port left over from testing. Also confirm that the certificate chain Data Prepper trusts matches the brokers' certificates, and plan how certificates are rotated without interrupting consumers. Any plaintext listener is a path for log data to be read on the network.

Kafka security overview

Choose a SASL mechanism for clients

Kafka's documented SASL mechanisms are GSSAPI (Kerberos), PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER. Pick the one your identity system can support and that Data Prepper's configuration can carry. PLAIN sends credentials that must be protected by TLS, so it should only be used over an encrypted listener. Confirm the mechanism and the secret storage approach with your Kafka and Data Prepper teams before building the pipeline.

Set the KRaft authorizer and ACLs

In KRaft clusters the StandardAuthorizer keeps ACLs in the cluster metadata log. Resources with no ACL are restricted to super users unless allow.everyone.if.no.acl.found is set to true. Keep that setting false in production so the Data Prepper consumer gets read access only to the topics and consumer group it needs. Review super user membership as part of the same change.

Kafka authorization docs

Scope the consumer group and topic rights

Give the Data Prepper identity read access to the source topics and to its own consumer group, and nothing that allows it to write to or delete other topics. Use a dedicated principal per pipeline so a credential leak or a misconfigured pipeline has a limited blast radius. Document which principal owns which topic so audits and rotations do not depend on memory.

Restrict who can write and read indexed data

The Kafka ACLs govern the pipeline, but the OpenSearch role decides who can later search the indexed data. Create a dedicated OpenSearch user or role for the Data Prepper pipeline that can only write to the target index pattern, and separate read roles for analysts. Field-level and document-level security can limit sensitive fields, if your data requires it. Verify these roles against the indexes the pipeline actually writes.

OpenSearch security docs

Common Kafka to OpenSearch failures and fixes

This table lists the failures teams most often hit when a Data Prepper pipeline reads Kafka topics and writes to OpenSearch, with the likely cause and the fix or confirmation step for each. Read it as a triage guide: match the symptom you see, check the cause in your own configuration and logs, then apply the fix before changing anything else.

FailureLikely causeFix or confirmation step
Pipeline fails at startup with no bootstrap_serversThe kafka source needs bootstrap_servers unless Amazon MSK is used, so the broker list is missing or misspelled in the pipeline fileSet bootstrap_servers to the broker addresses your Kafka cluster advertises, and confirm the pipeline file parses before restart
Consumer group cannot read the topicThe authorizer denies the group Read access on the topic or group, and resources without ACLs are restricted to super users unless allow.everyone.if.no.acl.found is trueGrant the Data Prepper principal Read on the topic and on the consumer group, then confirm the denial is gone in broker authorizer logs
TLS handshake errors on connectCertificate chain, hostname or truststore mismatch between Data Prepper and the broker listener, or a plaintext client hitting a TLS-only listenerConfirm the listener in use and its protocol, then check the truststore contents and the broker certificate's names against the address in bootstrap_servers
SASL authentication rejectedMechanism or credentials in the pipeline do not match a mechanism enabled on the listener (for example PLAIN configured where SCRAM is required)Compare the mechanism on the listener with the one in the source configuration, and rotate or re-enter credentials through your secrets process
Consumer lag grows while the pipeline is runningOpenSearch rejects bulk writes under load (for example full queues or disk watermarks), so Data Prepper slows and records accumulate in KafkaCheck OpenSearch rejection and disk metrics first, add indexing capacity or reduce batch pressure, and track lag per partition over time
Duplicate documents after a restartOffsets were not committed after bulk writes succeeded, so records are read again, and documents lack stable IDsSet document IDs derived from the source record where possible so re-indexing overwrites rather than duplicates, and confirm commit behavior in your pipeline version's docs
Client and broker version mismatch errorsKafka clients are older than the brokers allow, or the broker was upgraded past a supported client range; Kafka 4.0 removed ZooKeeper mode and needs Java 17 for brokersCheck the broker release against the Kafka downloads page and upgrade notes, confirm the client library version the pipeline ships with, and test on a non-production cluster first
Records arrive with unexpected fields or fail to indexMessage format or schema differs from the mapping, so parsing or index mapping rejects documentsInspect a sample of messages on the topic, align the index mapping and pipeline processors with them, and monitor dead-letter or failure output

Questions buyers ask before connecting Kafka to OpenSearch

What drives the effort and cost of connecting Kafka to OpenSearch with Data Prepper?

The main drivers are the topology (how many Kafka clusters, topics and Data Prepper pipelines there are), the security model (TLS, SASL mechanism and ACLs), whether Kafka is Amazon MSK or self-managed, and how many sizing and backpressure tests the workload needs before go-live. Each additional topic with its own parsing rules, owner and access boundary adds design and test work. Cost has two parts: one-time design, build and testing, and recurring operation of the Kafka brokers, Data Prepper nodes and OpenSearch cluster. Ask any partner for a quote that lists each topic, pipeline, security control and test run as a separate line so you can see what changes the price.

How long does a Kafka to OpenSearch ingestion project take?

Duration depends on scope more than on the tools. A single topic with an existing Kafka cluster, one pipeline and standard TLS is a small piece of work. Projects grow when they add MSK configuration, SASL authentication, several topics with different owners, index templates, or a formal load test to find where backpressure starts. Agree the duration in the written scope, with the testing and handover milestones listed separately, and ask what your team must have ready (access, certificates and named owners) before the clock starts. DeployOpen does not publish fixed timelines, so the timeline comes from the agreed scope.

What does our team need to provide before the work starts?

Plan to supply the following before any pipeline is built:

  • Kafka admin access, or a named admin who can create topics, consumer groups and ACLs
  • Certificates and trust chains for the brokers, plus the SASL credentials or identity provider settings if you use them
  • Index design decisions, including field mappings, retention and the OpenSearch cluster that receives the data
  • A named owner for each topic who confirms the message schema, expected volume and who may read it

Missing owners are the most common cause of delay, because nobody can confirm schema changes or approve access to sensitive topics.

Can our internal team build this ingestion pipeline without a partner?

Yes, if the team already runs Kafka and OpenSearch, has experience with TLS and SASL, and can allocate engineers for design, testing and operation. The Data Prepper kafka source reads records through the Kafka Consumer API and needs bootstrap servers unless Amazon MSK is used, so the work is well defined. The harder parts are consumer group design, backpressure sizing and access control on the indexed data. A partner is most useful when the team lacks one of those skills or needs an independent review of security settings. Whichever route you take, write down who owns each pipeline after launch.

Should we use Amazon MSK or a self-managed Kafka cluster?

Use Amazon MSK when your organization already runs on AWS and prefers a managed Kafka service, and self-managed Kafka when you need control over the broker platform, network placement or authentication options. The Data Prepper kafka source needs bootstrap_servers unless MSK is used, so the configuration differs between the two. Either way, the Kafka settings you choose (TLS, SASL mechanism, ACLs and retention) must be reviewed against your own security requirements. Confirm with your cloud and Kafka teams which option matches your hosting constraints before sizing the pipelines.

What Kafka upgrade rules apply before we connect to OpenSearch?

Apache Kafka 4.0 supports only KRaft mode, and ZooKeeper mode has been removed, so ZooKeeper-based clusters must migrate to KRaft before upgrading to 4.x. The Kafka upgrade notes also recommend that KRaft clusters older than 3.3.x upgrade to 3.9.x before moving to 4.x. Since Kafka 4.0, brokers, Kafka Connect and tools require Java 17, while clients and Kafka Streams applications require at least Java 11. Rolling upgrades are supported from each release in the past year to the latest version, according to the Kafka time-based release plan. The supported releases listed on the downloads page are 4.3.1, 4.2.2 and 4.1.2, so check your current version against that list before choosing a target.

What security controls should we plan for the Kafka topics feeding OpenSearch?

Plan encryption, authentication and authorization together. Kafka supports SSL/TLS for traffic between clients, brokers and tools, and security is optional, so clusters can run unsecured or mix secured and unsecured listeners. Make sure the ingestion path uses only secured listeners. Kafka authenticates clients with SSL or SASL, and the documented SASL mechanisms are GSSAPI (Kerberos), PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER. In KRaft clusters, the StandardAuthorizer stores ACLs in the metadata log, and resources without ACLs are restricted to super users unless allow.everyone.if.no.acl.found is set to true. Confirm that the Data Prepper client identity has only the read permissions it needs.

How events flow from producers through Kafka and Data Prepper into OpenSearch

Events start at producers that write to Kafka topics on the broker cluster. A Data Prepper pipeline reads those topics through its kafka source, which joins a consumer group, and places records in its kafka buffer before the OpenSearch sink writes them to indices. Check TLS and SASL at each hop, since the Kafka listener, the Data Prepper client and the OpenSearch connection each have their own trust boundary. Backpressure shows up as consumer lag on the group and as growing buffer pressure inside the pipeline.

Event path from producers through Kafka and Data Prepper into OpenSearch, with trust boundaries between hops.

How DeployOpen scopes and delivers Kafka ingestion for OpenSearch

DeployOpen plans Kafka-to-OpenSearch ingestion as a fixed-scope engagement inside your own infrastructure, starting with the topics, consumer groups, authentication and sizing decisions that determine how the pipeline behaves under load. The written scope, deliverables and timeline are agreed before work starts, and the pipeline is handed over with documentation your operators can run.

How we scope

  • Inventory the Kafka topics, record formats and expected event rates the pipeline must carry into OpenSearch.
  • Confirm whether your Kafka cluster is self-hosted, Amazon MSK or another managed service, and which bootstrap and authentication settings apply.
  • Agree in writing which OpenSearch indexes, access roles and retention expectations the ingestion work must satisfy.

How we build

  • Configure the Data Prepper kafka source with consumer group names, topic lists and deserialization settings for each agreed topic.
  • Choose and test the buffer design for backpressure, then size partitions and Data Prepper resources against measured throughput.
  • Verify TLS and SASL settings, Kafka ACLs for the pipeline's consumer identity, and OpenSearch write permissions with negative tests.

How we hand over

  • Deliver pipeline configuration files, topology notes and a record of every scope decision, with the reasons behind each sizing choice.
  • Document consumer lag alerts, restart behavior, offset handling and the steps for replaying a topic after a failed write.
  • Run a handover session with your platform and security teams, covering the operations runbook and the retest plan.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer, covering Data Prepper and Kafka version changes you approve.
  • Review consumer lag and backpressure trends with your team, and adjust partitions or pipeline resources through a change record.
  • Retest authentication, authorization and data exposure paths after each change to the pipeline or the Kafka cluster.

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.