---
title: AWS Kinesis Streams logs
slug: telemetry-pipeline/aws-kinesis-streams-logs
docTags: 
createdAt: 2025-04-21T00:56:29.528Z
---

## AWS Kinesis Streams (logs)&#x20;

AWS Kinesis Streams is used when you want **near-real-time log ingestion with ordered, partitioned delivery**.
&#x20;Worker batches log events, encodes them, and pushes them as Kinesis records.
&#x20;Key design levers are:

- **Partitioning** (how logs are distributed across shards)&#x20;
- **Batch size vs latency** (Kinesis has strict per-record and per-request limits)&#x20;
- **Backpressure & buffering** (what happens when Kinesis throttles)&#x20;
- **Concurrency & retry behavior** (how aggressively worker pushes)&#x20;

This sink is typically used as a **fan-out ingestion layer** before Lambda, Kinesis Analytics, Firehose, or custom consumers.

## Core destination & routing

### stream\_name

The target Kinesis **data stream**.
&#x20;This is the logical pipe logs are written into.
&#x20;Shard count, retention, and scaling behavior are defined on the stream side, not here.

### region

AWS region where the stream lives.
&#x20;Must match the region of the Kinesis stream, otherwise requests will be signed incorrectly.

### endpoint

Overrides the AWS Kinesis endpoint.
&#x20;Used mainly for:

- AWS-compatible environments&#x20;
- Local testing / emulators&#x20;
- Private endpoints or special partitions&#x20;

## Partitioning & ordering (very important for Kinesis)

### partition\_key\_field

Defines which **log field** is used as the Kinesis partition key.

Why this matters:

- Records with the same partition key **always go to the same shard**&#x20;
- Ordering is preserved **per partition key**&#x20;
- Hot partition keys can overload a shard&#x20;

If not set:

- Worker generates a random/unique key&#x20;
- Distribution is even, but **ordering is lost**&#x20;

Typical strategies:

- Use tenant ID, service name, or host ID&#x20;
- Avoid high-cardinality + bursty fields that create shard hot-spots&#x20;

## Batching (latency vs throughput trade-off)

### batch.max\_bytes

Maximum size of a batch before it is sent.
&#x20;This protects you from exceeding Kinesis request limits.

Larger values:

- Better throughput&#x20;
- Higher latency&#x20;
- Higher risk of throttling&#x20;

Smaller values:

- Lower latency&#x20;
- More API calls&#x20;

### batch.max\_events

Maximum number of log events per batch.
&#x20;Useful when events are small but numerous.

### batch.timeout\_secs

Maximum time worker waits before flushing a batch.

Key behavior:

- Kinesis favors **small, frequent batches**&#x20;
- Default is very low (1s) to keep latency tight&#x20;

## Buffering (what happens when Kinesis slows down)

### buffer.type

Where events are queued before delivery:

- **memory**: fast, volatile&#x20;
- **disk**: durable, survives restarts&#x20;

Kinesis throttling is common → disk buffer is safer for production pipelines.

### buffer.max\_size

Hard cap on buffer storage.
&#x20;Once reached, worker must either block or drop events.

### buffer.max\_events

Event-count cap for memory buffers.
&#x20;Prevents unbounded memory growth.

### buffer.when\_full

Behavior when the buffer is exhausted:

- **block**: apply backpressure upstream (preferred for reliability)&#x20;
- **drop\_newest**: keep running but lose data&#x20;

## Compression

### compression

Controls whether records are compressed before sending.

Options like gzip or zstd:

- Reduce payload size&#x20;
- Lower shard bandwidth usage&#x20;
- Add CPU overhead&#x20;

Default is none because:

- Kinesis record size limits are strict&#x20;
- Many consumers expect raw payloads&#x20;

Compression choice must match **consumer expectations**.

## Encoding (what is actually sent into Kinesis)

### encoding.codec

Defines the wire format of each record:

- json, text, avro, cef, protobuf, etc.&#x20;

This directly impacts:

- Consumer parsing logic&#x20;
- Schema evolution&#x20;
- Interoperability with AWS services&#x20;

### encoding.\* (codec-specific options)

Each codec has its own tuning knobs:

- CSV field order&#x20;
- JSON formatting&#x20;
- Avro schema&#x20;
- CEF metadata&#x20;

These do **not** affect delivery mechanics, only payload structure.

## Authentication & identity

### auth.\*

Controls how worker authenticates to AWS:

- Static keys&#x20;
- Assume-role&#x20;
- Instance metadata (IMDS)&#x20;
- Named credential profiles&#x20;

Important operational notes:

- Assume-role adds STS calls (latency + retry impact)&#x20;
- IMDS requires network access to the metadata service&#x20;
- Region mismatches can break signing&#x20;

## Request behavior & throughput control

### request.concurrency

How many requests worker sends in parallel.

- Higher concurrency = higher throughput&#x20;
- Too high = throttling, retries, shard pressure&#x20;

### request.rate\_limit\_num / request.rate\_limit\_duration\_secs

Explicit rate limiting to protect:

- Kinesis shard limits&#x20;
- Downstream AWS account quotas&#x20;

### request.timeout\_secs

How long worker waits for AWS to respond.

Too low:

- Causes retries and duplicates&#x20;

Too high:

- Slows failure detection&#x20;

## Retries & partial failures

### request.retry\_attempts

Maximum retry count for failed requests.

### request\_retry\_partial

Whether worker retries **partially successful** Kinesis responses.

Why this exists:

- Kinesis can accept some records and reject others in the same request&#x20;
- Retrying partials improves reliability but increases duplicates risk&#x20;

### request.retry\_\* backoff controls

Shape how retries ramp:

- Initial delay&#x20;
- Max delay&#x20;
- Jitter to avoid retry storms&#x20;

## Proxy & TLS (network path)

### proxy.\*

Routes traffic through HTTP(S) proxies.
&#x20;Useful in restricted or enterprise networks.

### tls.\*

Controls certificate trust, hostname verification, and client auth.

Critical for:

- Private endpoints&#x20;
- Man-in-the-middle proxies&#x20;
- AWS-compatible non-AWS backends
