AWS-EventStream-Parser Filter (proto)

This extension has the qualified name envoy.filters.http.aws_eventstream_parser

Note

This extension is functional but has not had substantial production burn time, use only with this caveat.

This extension is intended to be robust against untrusted downstream traffic. It assumes that the upstream is trusted.

Tip

This extension extends and can be used with the following extension category:

This extension must be configured with one of the following type URLs:

Warning

This API feature is currently work-in-progress. API features marked as work-in-progress are not considered stable, are not covered by the threat model, are not supported by the security team, and are subject to breaking changes. Do not use this feature without understanding each of the previous points.

The AWS-EventStream-Parser filter extracts values from AWS EventStream HTTP response bodies and writes them to dynamic metadata. This is useful for AWS Bedrock streaming response processing, token usage tracking, logging, and other observability use cases.

The filter specifically handles the AWS EventStream binary protocol (application/vnd.amazon.eventstream) and uses pluggable content parsers to extract values from the message payloads. The content parser is a typed extension that can be configured to handle different content types (JSON, plaintext, XML, etc.).

The filter only processes responses with Content-Type “application/vnd.amazon.eventstream”. Content-Type parameters are ignored.

See AWS-EventStream-Parser configuration overview for more details.

extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser

[extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser proto]

{
  "response_rules": {...}
}
response_rules

(extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.ProcessingRules, REQUIRED) Rules for processing AWS EventStream response streams.

extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.HeaderKeyValuePair

[extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.HeaderKeyValuePair proto]

Metadata action to write when an EventStream header matches or is missing.

{
  "metadata_namespace": ...,
  "key": ...,
  "value": {...}
}
metadata_namespace

(string) The namespace — if this is empty, the filter’s namespace will be used. Default: “envoy.filters.http.aws_eventstream_parser”.

key

(string, REQUIRED) The key to use within the namespace.

value

(Value) Optional: a fixed value to use instead of the header’s actual value. When set for on_present, uses this value instead of the header value. Required for on_missing (since there is no header value available).

extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.HeaderRule

[extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.HeaderRule proto]

A rule for extracting an EventStream message header to dynamic metadata.

{
  "header_name": ...,
  "on_present": {...},
  "on_missing": {...},
  "stop_processing_after_matches": {...}
}
header_name

(string, REQUIRED) The EventStream header name to match. Case-sensitive.

on_present

(extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.HeaderKeyValuePair) If the header is present in a message, apply this metadata action.

on_missing

(extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.HeaderKeyValuePair) If the header was not found in any message by end-of-stream, apply this metadata action. The value field in the HeaderKeyValuePair must be set (since there is no header value).

stop_processing_after_matches

(UInt32Value) Controls how many times this rule should successfully match before stopping evaluation of this rule for subsequent messages.

  • If set to 0 (default): This rule is evaluated against all messages. Later matches overwrite earlier values, effectively extracting the LAST occurrence.

  • If set to 1: Stop evaluating this rule after the first successful match. This is useful for extracting header values that appear early in the stream to avoid unnecessary processing of subsequent messages.

  • If set to N > 1: Reserved for future use. Values > 1 are currently rejected.

When all header rules AND all content parser rules have stop_processing_after_matches limits set and all limits are satisfied, the filter stops processing the stream entirely.

extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.ProcessingRules

[extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.ProcessingRules proto]

Rules for processing AWS EventStream streams and extracting metadata.

The filter parses the AWS EventStream binary protocol (messages with headers and payloads), then delegates to a content parser to parse the message payload and extract metadata. The content parser determines which values to extract and how to write them to metadata.

{
  "content_parser": {...},
  "header_rules": []
}
content_parser

(config.core.v3.TypedExtensionConfig, REQUIRED) Content parser configuration for parsing message payloads and extracting metadata.

The content parser specifies: - How to parse the message payload (e.g., JSON, XML, plaintext) - Which values to extract from the parsed content (e.g., JSON paths like usage.total_tokens) - How to map extracted values to metadata (namespace, key, type conversions) - When to write metadata (on_present, on_missing, on_error actions)

Tip

This extension category has the following known extensions:

header_rules

(repeated extensions.filters.http.aws_eventstream_parser.v3.AwsEventstreamParser.HeaderRule) Rules for extracting EventStream message headers to dynamic metadata. These are evaluated directly by the filter (not by the content parser). Headers are simple typed key-value pairs at the EventStream protocol level.

Header values are automatically converted to the appropriate Protobuf value type: - BoolTrue/BoolFalse -> bool_value - Byte/Short/Int32/Int64/Timestamp -> number_value - String -> string_value - ByteArray -> string_value (hex-encoded) - UUID -> string_value (formatted as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)