Ingesting logs from Amazon S3 into OpenSearch with Data Prepper

Teams storing CloudTrail, load balancer or application logs in S3 can load them into self-hosted OpenSearch with Data Prepper's s3 source. This page covers the method, prerequisites, setup order, field mapping, security and failure points.

On this page

How Data Prepper's s3 source loads S3 logs into OpenSearch

Data Prepper's s3 source inside a pipeline is the supported way to load logs that already sit in Amazon S3 into self-hosted OpenSearch. A team with load balancer access logs, CloudTrail records or application logs written to buckets does not need to rewrite its logging path to make that data searchable. Data Prepper is part of the OpenSearch project, which is released under the Apache License, Version 2.0, so the ingestion component and the cluster it writes to carry no paid edition or license fee to plan around. The OpenSearch Data Prepper documentation lists S3 logs as a common use case for the s3 source, which makes it the natural starting point, but the exact source options, authentication settings and notification behavior must be confirmed against the current Data Prepper docs for the version you deploy.

The pipeline follows a simple sequence. The s3 source reads the objects it is told to process, a codec decodes each object's contents into events (the codec choice depends on whether the files are newline-delimited JSON, plain text or another supported format, so inspect a sample object before you commit), processors parse, rename or drop fields, and a sink writes the results to an OpenSearch index. The page covers how to design that pipeline, which decisions shape it (object discovery, codec selection, field mapping, index naming and access to the bucket) and how to verify that every object was ingested exactly once. Confirm which discovery mechanism your version supports, how it tracks processed objects, and what the IAM permissions for the bucket and any queue must include before you grant them.

What you need before building the S3 logs pipeline

Six groups of decisions have to be settled before a Data Prepper pipeline reads from S3. Each one constrains the others: the cluster version and install method shape the Data Prepper release you can run, and the bucket layout and notification path determine which IAM actions and network routes the pipeline needs.

OpenSearch cluster version and install method

Record the OpenSearch version your cluster runs and how it was installed (Docker, Helm, the Kubernetes Operator, tarball, RPM, Debian or Ansible). Check the version against the OpenSearch releases page, since a version in maintenance receives only bug fixes and security patches. Confirm which Data Prepper release is compatible with that cluster version in the Data Prepper documentation, and confirm the index templates and ingest permissions the pipeline will use.

Installation docs

Data Prepper deployment

Decide where Data Prepper runs (a container beside the cluster, a Kubernetes workload or a VM) and which release you pin. Plan the pipeline configuration file, its mount path and how changes are rolled out. Confirm the exact Data Prepper version in your own environment before you write any pipeline YAML, because source options and codecs change between releases.

S3 buckets and object layout

List each bucket and prefix that holds load balancer, CloudTrail or application logs, and note the file format and compression of each. Settle the key layout (for example, one prefix per account and region) so the pipeline can filter by prefix and avoid rereading archived data. Confirm retention and lifecycle rules on these buckets, since objects removed before ingestion are never indexed.

IAM read permissions

Create a dedicated role for Data Prepper with read access limited to the listed buckets and prefixes. Confirm the exact IAM actions the s3 source calls in your Data Prepper version, including any actions needed for the queue or notification path you choose, and test them with a non-production role first. Keep write and delete actions out of this role.

S3 source docs

Queueing or notification path

Choose how Data Prepper learns about new objects: an SQS queue fed by S3 event notifications, or a scan of the bucket. A queue scales better for large, continuously written buckets, but it adds a dead-letter queue, retention settings and its own permissions to manage. Confirm the notification setup and queue limits in your AWS account before you create the pipeline.

Network routes and TLS certificates

Map the routes from Data Prepper to S3 (through a NAT gateway, an S3 VPC endpoint or a proxy) and from Data Prepper to the OpenSearch HTTPS port. Confirm that security groups and firewalls allow both paths. Decide which certificate authority signs the cluster certificate, install that CA in the Data Prepper trust store, and set a rotation date so the pipeline does not fail on expiry.

Configuring the S3 source, codec and OpenSearch sink

This sequence takes an S3 log bucket from unknown format to a tested Data Prepper pipeline that reads one prefix, parses each record and writes it to a named OpenSearch index. Each step closes with a check, so the team knows the pipeline works before it reads the full bucket.

  1. Confirm log formats for each bucket

    The platform owner and the log source owners list each bucket and prefix that will feed OpenSearch, and record the format of each one: plain text lines, JSON lines, gzip-compressed objects, or CloudTrail-style JSON documents. Each format decides the codec and the processors that follow. Pull a few sample objects from each prefix and confirm the format by reading them directly. The check is a written table with one row per prefix, its format, its compression and a named owner for any field that will be indexed.

  2. Create a read-only identity for the bucket

    The cloud or identity team creates a dedicated identity that Data Prepper uses to read from S3, scoped to the approved bucket and prefixes only. It needs list and read access on those objects, and it should not have write or delete rights. If the pipeline uses an SQS notification queue to discover new objects, the identity also needs access to that queue. Store the credentials or role binding in your secrets store, not in the pipeline file. The check is a successful list and read of one sample object using only that identity, and a failed attempt to read a prefix outside the grant.

  3. Deploy Data Prepper beside the cluster

    The platform team deploys Data Prepper in the same infrastructure as the OpenSearch cluster, or on a network path that reaches it, using the installation method your standards already cover. Confirm the version against the Data Prepper documentation for the OpenSearch release you run. Keep the service off public networks and point its configuration directory at version-controlled pipeline files. The check is a running Data Prepper process with a clean start log and a successful network connection to the OpenSearch endpoint.

  4. Write the s3 source with the chosen codec

    The engineer writes the pipeline's s3 source, naming the bucket, the single prefix under test, the authentication method, and the codec that matches the format confirmed in step one. The source documentation lists the available codecs and options, including how compressed objects and notifications are handled, so confirm each key against the version you deploy. Start with one prefix and keep the scan settings conservative until the first run is clean. The check is a pipeline log that shows objects being discovered and read from the test prefix, with no authorization errors.

  5. Add processors for parsing and enrichment

    The engineer adds processors that turn raw records into structured documents, such as splitting JSON fields, renaming keys to your naming convention, parsing timestamps into one time field, and dropping noisy or sensitive fields before they reach the index. Keep each processor small and documented so reviewers can trace a field back to its rule. Add masking or drop rules for any data the security team classified as restricted. The check is a sample of indexed documents where the timestamp, source fields and removed fields match the written field mapping.

  6. Configure the OpenSearch sink and index naming

    The engineer configures the opensearch sink with the cluster endpoints, TLS trust material and a dedicated write user whose role allows only the target index pattern. Choose an index naming pattern that includes the source and a date component so retention and lifecycle policies can act on it later. Confirm that the index template exists before the first write, so field types are set correctly. The check is a successful bulk write from the pipeline, a new index with the expected name, and a document count that matches the number of records in the test objects.

  7. Test with one prefix and confirm results

    The team runs the pipeline against the single test prefix and compares the results with the source objects. They check the document count, sample a set of records for parsed fields, confirm that rejected or failed records are logged rather than silently lost, and verify that the write user cannot touch indexes outside its pattern. Only after this run is clean does the team widen the prefix list. The check is a signed-off test record showing the count, the field sample, the error log review and the permission test, which becomes the baseline for the rollout.

How logs move from S3 to OpenSearch Dashboards

Logs start in the application, load balancer or CloudTrail, which write objects to an S3 bucket in the AWS account. A notification or polling path tells Data Prepper's s3 source that new objects exist, and the source reads them into a pipeline where the codec and processors parse each record. The OpenSearch sink then writes the results to indexes in the cluster you run, and Dashboards reads from there. Check the crossings: the IAM role that lets Data Prepper read the bucket, the network path from your VPC to S3, and the credentials Data Prepper uses to write to OpenSearch.

Log flow from S3 through Data Prepper into OpenSearch, with trust boundaries marked.

How codecs and processors shape log events

The codec decides how Data Prepper turns the bytes of each S3 object into events, and processors decide what those events look like before they reach the OpenSearch sink. Get the codec wrong and every later step works on the wrong structure, so confirm the codec choice first. For load balancer and CloudTrail logs, the object format (plain lines, gzip-compressed files or JSON documents with a record array) determines which codec options apply. Check the codec names, their options and how each handles compressed input in the Data Prepper S3 source documentation before you write the pipeline, and test with a sample object from each log type.

Processors then parse, rename and enrich the fields. You decide whether Data Prepper parses raw lines with its grok or date processors, renames fields to your schema, and adds fields such as source account or region, or whether the pipeline keeps events close to raw and leaves parsing to an OpenSearch ingest pipeline. Parsing in Data Prepper keeps the pipeline self-contained and lets you filter or drop events before they are indexed, which lowers storage. Parsing later with ingest pipelines keeps the pipeline simple and puts the transformation logic where index administrators already maintain it, but every event is indexed in its raw form first. Confirm the processor names, their options and error handling for your Data Prepper version in the docs, and record which fields each log type must produce.

Write the decision down per log type. Load balancer logs, CloudTrail records and application logs have different field sets and volumes, so one parsing location may not fit all three. Ask the team that owns each log type which fields they query and which must match a retention or audit schema, then test the processor chain on a sample file and compare the resulting documents with the expected mapping. Re-run that test whenever the log format changes, because a silent parse failure produces documents that index without error but lack the fields your searches depend on.

Mapping CloudTrail, load balancer and application log fields

This table compares the three log families this pipeline usually carries and shows how each source field should land in the OpenSearch index. Read each row as a decision to confirm against a real sample before the index template is written, because a wrong type or timestamp choice is hard to undo once data is indexed.

Log family and fieldTypical source keyTarget field and typeWhat to confirm
CloudTrail event timeeventTime@timestamp as date, UTCConfirm the pipeline parses this value rather than the S3 object time, so time-based searches match when the API call happened.
CloudTrail caller identityuserIdentity.arn, userIdentity.typeuser.arn and user.type as keywordKeep identity values as keyword for filtering and access reviews. Check which identity types appear in your trail before you write field mappings.
CloudTrail API action and sourceeventName, eventSource, sourceIPAddressevent.action, event.provider and source.ip as keyword or ipMap the IP field to an ip type only if every record holds a valid address. Some AWS service events carry a service name instead of an IP.
ELB access log timestamp and statustime, elb_status_code@timestamp as date, http.response.status_code as integerConfirm the log format for your load balancer type, since field order and names differ between access log formats.
ELB client and target fieldsclient:port, target:port, request_processing_timesource.address, destination.address and event.duration as numeric valuesSplit host and port in the pipeline. Confirm the time unit in the sample before you store it as a number.
Application JSON timestamptimestamp or time (application specific)@timestamp as date with an explicit formatConfirm the format and time zone. Mixed formats across services are a common cause of rejected documents.
Application free-text messagemessage or msgmessage as text with a keyword sub-fieldUse text for full-text search and keyword for exact matches. Check the field size limit your index settings enforce on long messages.
Index name and templateNot in the source recordDaily or weekly index names such as logs-cloudtrail-YYYY.MM.DD, matched by an index templateConfirm the naming pattern and template priority with your search team before the first load. Changing field types later usually means reindexing.

Securing the S3 read path and the OpenSearch target

The pipeline touches two trust boundaries: the role that reads log objects from S3 and the identity that writes them into OpenSearch. Each card below covers one control on either side, plus the audit trail that shows what the pipeline wrote. Confirm the exact IAM and Data Prepper settings against the current documentation before you configure them.

Scope read access to named prefixes

Grant the Data Prepper role s3:GetObject only on the bucket prefixes that hold the load balancer, CloudTrail or application logs you intend to index, and s3:ListBucket restricted by prefix condition so the reader cannot enumerate the rest of the bucket. Keep write and delete permissions off this role entirely. Check the policy with the IAM policy simulator using a sample object key from each prefix before the pipeline goes live.

Data Prepper S3 source

Protect objects with bucket encryption

Decide whether log objects use SSE-S3 or a customer-managed KMS key. With a KMS key, the Data Prepper role also needs decrypt permission on that key, and the key policy must allow the role. Missing key permissions usually appear as access errors that look like bucket policy problems, so test decryption directly. Confirm which encryption options the Data Prepper S3 source supports in your version.

Require TLS for S3 and OpenSearch traffic

Enforce aws:SecureTransport in the bucket policy so reads over plain HTTP are denied. On the OpenSearch side, enable TLS for both node and client traffic through the Security plugin, and point the pipeline sink at the HTTPS endpoint with a trusted CA certificate. Do not disable certificate verification to get a pipeline running; fix the trust chain instead.

Store Data Prepper credentials outside config files

Keep the IAM role or access keys and the OpenSearch user password out of the pipeline YAML and out of version control. Prefer an instance or pod role for S3 access, and inject OpenSearch credentials from a secrets store or a Kubernetes secret mounted at runtime. Rotate them on a schedule you can name, and confirm how your Data Prepper release reads environment variables or secret files.

Use a dedicated OpenSearch role for writes

Create a role in the Security plugin that grants create_index and write only on the target index pattern, such as logs-s3-*, and map the pipeline user to it. Avoid all_access and avoid index patterns that cover security or system indices. Field-level security or field masking can hide sensitive fields from downstream readers, but it does not stop the pipeline from writing them, so filter those fields in the pipeline.

OpenSearch security docs

Audit what the pipeline writes

Enable audit logging in the Security plugin and decide which categories to record for the pipeline user, including failed writes and index creation. Route audit output to storage your security team controls, with a retention period set by your own policy. Compare audit records against S3 object keys periodically so you can show which source objects produced which indexed documents.

How to test the pipeline before production traffic

Test the pipeline against a known sample set before any production bucket is connected. Choose a fixed group of S3 objects that represent each log type you plan to load, such as load balancer access logs, CloudTrail files and application logs, and record how many objects and how many log lines or records each contains. Run the Data Prepper pipeline against that set into a non-production index, then compare the number of documents in OpenSearch with the record count you calculated from the source files. A mismatch usually points to a codec setting that splits records differently than expected, a multiline or compressed file handled incorrectly, or events dropped at a sink. Confirm the counts per object, not only the total, so you can trace any gap to a specific file.

Next, check the content of the documents rather than only their number. Confirm that the timestamp field is parsed into a date type and that it matches the time inside the log line, not the time the object was ingested. Check that numeric fields such as status codes and byte counts are stored as numbers, and that fields you expect to filter on are keyword or the intended type in the index mapping. Then feed deliberately malformed records, such as truncated JSON lines, a CloudTrail file with an unexpected structure, and a line with a missing timestamp, and confirm the pipeline behavior you have chosen. Decide in advance whether bad records should be dropped, sent to a dead-letter location, or indexed with a tag, and verify that the choice holds.

Finally, test re-delivery. Reprocess the same S3 objects, or trigger the notification path twice for one object, and confirm that the document count does not increase. Duplicates are the most common source of inflated counts in S3-based ingestion, so decide how document IDs are assigned and verify that the chosen approach prevents them. Record every test in a runbook: the sample set and its object list, the Data Prepper and OpenSearch versions, pipeline YAML, index template, expected counts and results. Repeat the same suite after each Data Prepper or OpenSearch upgrade. Confirm the exact configuration keys and behavior for your release in the Data Prepper S3 source documentation before you write the test expectations.

Why S3 log pipelines stall or lose fields

This table lists the failures that most often stop or degrade an S3-to-OpenSearch pipeline, with the cause and fix for each. Read it as a checklist: match the symptom you see in the pipeline or cluster to a row, then confirm the fix against your own bucket, codec and index template settings.

FailureLikely causeFix
Access denied on the bucketThe IAM role or credentials used by the s3 source cannot list the bucket or read objects, often because the SQS notification path or KMS key policy was not granted.Grant read and list on the bucket and objects, plus access to the SQS queue and any KMS key used for encryption. Confirm each permission in the s3 source documentation before the first run.
Wrong codec for the file formatThe codec in the pipeline does not match the file, such as parsing newline-delimited JSON as a single document or CSV with the wrong header setting.Match the codec to the file format for each source prefix. Test on a sample object and check that one event is produced per log line before scaling up.
Compressed objects not decodedObjects are stored gzipped, and the codec or compression setting does not decompress them, so events arrive as binary or unreadable text.Set the compression option to match the stored format. Confirm the setting against the s3 source documentation, then reprocess a sample object to verify readable events.
Mapping conflicts from mixed field typesThe same field arrives as a number in one file and a string in another, for example a status code, so the index rejects documents or stores the field inconsistently.Define explicit mappings in an index template before ingestion. Normalize types in the pipeline with processors, and route rejected documents to a dead-letter location for review.
Sink rejections when the index template is missingThe pipeline writes to a new index name, and dynamic mapping or index settings do not match the intended design, or the index pattern lacks the expected template.Create the index template and any lifecycle policy before starting the pipeline. Confirm index names match the template pattern in a test run.
Clock skew affecting time fieldsSource servers or services write timestamps in a different time zone or with drift, so events land in the wrong index or fall outside time-based queries.Parse the timestamp with an explicit format and time zone. Monitor host time sync on the log producers and check event times against ingest time during testing.
Backlog growth when the pipeline falls behindObject volume grows faster than the pipeline can read and write, or the sink slows down, so messages queue and visibility of recent logs lags.Watch queue depth and sink errors, then scale workers or pipeline capacity and reduce per-event processing. Confirm sizing with a load test on representative object sizes.

Questions teams ask before building S3 log ingestion

What drives the effort and cost of loading logs from S3 into OpenSearch?

Effort follows the number of log types, the volume and shape of the objects in each bucket, and how deeply the logs must be parsed and enriched before they are indexed. A load balancer log feed with one fixed format is far smaller work than CloudTrail plus application logs with several timestamp formats and multi-line events. Other cost drivers are the IAM roles and bucket policies, the network path between AWS and the cluster, the SQS notification setup for new objects, and the testing needed to show that no records are lost or duplicated. Most of this is one-time build work. Recurring costs are the infrastructure that runs Data Prepper and the cluster, plus changes when a log format changes. Ask any partner for a quote that lists each log type, the parsing depth, and the environments it will be tested in.

Can our own team build S3 log ingestion with Data Prepper?

A team with working AWS and OpenSearch experience can build a first pipeline, especially for one log type with a known format. The Data Prepper S3 source is documented with its use cases, and the build is mostly configuration, IAM and testing. The harder part is the surrounding work: deciding index naming and retention, handling failed or malformed objects, keeping credentials out of configuration files, and proving the pipeline behaves the same after an upgrade. If those skills are thin in your team, a fixed-scope engagement can cover the design and the handover. Either way, write down the ownership of each piece before work starts.

How long does a first S3 pipeline usually take to validate?

The first pipeline usually takes longer to validate than to write, because validation depends on real objects, real permissions and real volumes. Plan time for sample objects from each source, a check that new objects trigger processing, a comparison of document counts against the source files, and a test of how bad records are handled. Duration grows with the number of log types and with any approval step for IAM changes or network rules in your AWS accounts. This page does not give a figure. Ask for a timeline that is tied to the written scope and to the environments you control.

What do we need from our AWS and OpenSearch owners?

The work needs decisions and access from both sides. From the AWS owners, expect requests for read access to the source buckets, permission to create or review an SQS queue and event notifications, IAM roles for the Data Prepper process, and a view of any KMS keys that encrypt the objects. From the OpenSearch owners, expect requests for an index template and retention plan, a role with write rights limited to the target indexes, TLS certificates and the connection settings for the cluster, and a place to run Data Prepper with monitoring. Agree on who approves changes to each area before the build starts, so that testing is not blocked by a ticket queue.

Is Data Prepper the right choice compared with other log collectors?

Data Prepper is a good fit when you want OpenSearch's own ingestion tooling to read from S3, parse and route events, and write to OpenSearch in one pipeline. Other collectors can also load S3 logs, and the right choice depends on where the logs originate, how much transformation you need before indexing, and what your team already runs. Compare the source type, the parsing rules, the operating model and the monitoring you already have. The sibling topics on Fluent Bit, Logstash and Kafka buffering cover those alternatives. Confirm current Data Prepper source options against the official documentation before you commit.

Does DeployOpen quote this work from a written scope?

Yes. DeployOpen plans, implements and documents self-hosted open-source platforms inside the client's own infrastructure, including their AWS accounts and OpenSearch clusters. Most engagements are fixed-scope, so the scope, deliverables and timelines are agreed in writing before work starts. A quote follows from that written scope, which should list the log types, the parsing and enrichment requirements, the AWS and OpenSearch environments, the access model and the testing you expect. DeployOpen does not publish a price list. Ongoing support and upgrades can be added as a retainer if you want them after the first pipeline is validated.

What should we check on the data before we start?

Check the data before the build, because the source decides most of the parsing work. Confirm the bucket layout, the object naming, the compression used, whether objects are appended or rewritten, and whether logs contain personal data or secrets that must be masked before indexing. Confirm the retention period each log type needs and any residency or access rules that apply to the bucket. The answers determine the index design, the field mappings and the access roles on the OpenSearch side, so collect them early.

How DeployOpen works on this

DeployOpen plans S3 log ingestion into self-hosted OpenSearch as a fixed-scope engagement, starting with the bucket layout, log formats and access model in your AWS account. We build and test the Data Prepper pipeline in your infrastructure, then document and hand it over so your team can run and change it.

How we scope

  • Inventory the source buckets, log types (load balancer, CloudTrail or application) and object volumes before any pipeline is designed.
  • Agree which codecs, SQS notification setup and target indexes the written scope covers, with each deliverable named.
  • Confirm IAM roles, bucket encryption, network paths and where the OpenSearch cluster and its access controls will run.

How we build

  • Configure the Data Prepper s3 source and pipeline in your environment, using the documented S3 logs pattern as the starting point.
  • Test parsing with representative samples, including malformed and rotated log files, and check that index mappings match the expected fields.
  • Verify access to the target indexes through the OpenSearch Security roles agreed for the team, and confirm audit logging is recording the writes.

How we hand over

  • Deliver the pipeline configuration, IAM policy definitions, deployment steps and a runbook for restarts, replays and failed-object handling.
  • Walk your platform and security staff through the pipeline design, the data flow and the known limits of each codec used.
  • Document how to add a new log source, change a retention setting or rotate the credentials that Data Prepper uses to read S3.

How we support

  • Ongoing support, upgrades of Data Prepper and OpenSearch, and continuous testing are available as a retainer under a separate written agreement.
  • Ask us to plan an upgrade path against the OpenSearch maintenance window for your cluster version before changing the pipeline.
  • Use a retainer to retest the pipeline after changes to bucket policies, log formats or the cluster's security configuration.

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.