Skip to content

Support pre-decompression header skipping in DecompressionEngine #7021

Description

@yavmanis

Problem Statement

Some data producers (log forwarders, Kafka connectors, ETL tools) prepend an application-level metadata header to compressed payloads before writing to storage. The current DecompressionEngine implementations have no mechanism to handle these headers, causing decompression failures.

Example File Format

A Palo Alto Networks firewall log forwarder writes files to S3 in this format:

{"compression": "snappy", "topic": "fwd_d6b6a0e7-5519-442a-b69c-60c759501fa3_1435757634.firewall.hipmatch", "key": "0-0-panw.firewall.hipmatch-genericjson", "num_bytes": 1260, "num_records": 10}
<snappy-compressed binary payload>
  • Line 1: Plain-text JSON metadata (application-level, not part of any compression spec)
  • Remaining bytes: Raw Snappy block-compressed NDJSON records

With compression: "snappy", SnappyDecompressionEngine passes the entire stream (including the header) to SnappyInputStream, which fails due to this custom header

Proposed Solution

Add a decompression_options configuration at the codec level (data-prepper-plugins/common) that allows skipping bytes from the raw stream before decompression is applied. This will be implemented as a decorator around existing DecompressionEngine implementations, keeping them unchanged and stateless.

Configuration

compression: "snappy"
decompression_options:
  skip_lines: 1

Available options (mutually exclusive — exactly one may be specified):

Option Description
skip_lines Skip N newline-delimited lines before decompressing
skip_bytes Skip a fixed number of bytes before decompressing
skip_until_delimiter Skip all bytes until the first occurrence of a delimiter string
skip_until_pattern Skip bytes matching a regex pattern at the start of the stream

If decompression_options is omitted, existing behavior is preserved.

Example Pipeline

s3-pipeline:
  source:
    s3:
      compression: "snappy"
      decompression_options:
        skip_lines: 1
      codec:
        newline:
  sink:
    - opensearch:
        index: "firewall-logs"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    Unplanned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions