Amazon MSK
Synopsis
Creates a target that writes log messages to Amazon Managed Streaming for Apache Kafka (MSK) topics with support for batching, compression, and SASL or mutual TLS authentication. The target handles message delivery efficiently with configurable batch limits based on size or event count. Amazon MSK is a fully managed Apache Kafka service on AWS.
Schema
- name: <string>
description: <string>
type: amazonmsk
pipelines: <pipeline[]>
status: <boolean>
properties:
address: <string>
port: <numeric>
client_id: <string>
topic: <string>
algorithm: <string>
username: <string>
password: <string>
compression: <string>
compression_level: <string>
acknowledgments: <string>
allow_auto_topic_creation: <boolean>
disable_idempotent_write: <boolean>
max_bytes: <numeric>
max_events: <numeric>
batch_mode: <string>
batch_separator: <string>
field_format: <string>
tls:
status: <boolean>
insecure_skip_verify: <boolean>
min_tls_version: <string>
max_tls_version: <string>
cert_name: <string>
key_name: <string>
passphrase: <string>
debug:
status: <boolean>
dont_send_logs: <boolean>
Configuration
The following fields are used to define the target:
| Field | Required | Default | Description |
|---|---|---|---|
name | Y | Target name | |
description | N | - | Optional description |
type | Y | Must be amazonmsk | |
pipelines | N | - | Optional post-processor pipelines |
status | N | true | Enable/disable the target |
Amazon MSK Connection
| Field | Required | Default | Description |
|---|---|---|---|
address | Y | - | MSK broker bootstrap server address. Supports a single address or a comma-separated list for multiple seed brokers (e.g., "b-1.mycluster.abc123.kafka.us-east-1.amazonaws.com:9092,b-2.mycluster.abc123.kafka.us-east-1.amazonaws.com:9092"). Each entry may include a port; if omitted, the port field value is appended. |
port | N | 9092 | MSK broker port. Each listener on the cluster has its own port, so take the value from the Amazon MSK console and set it explicitly |
client_id | N | - | Client identifier for connection tracking |
topic | Y | - | Kafka topic name for message delivery |
Authentication
| Field | Required | Default | Description |
|---|---|---|---|
algorithm | N | "none" | Authentication mechanism: none, plain, scram-sha-256, scram-sha-512 |
username | N* | - | Username for SASL authentication |
password | N* | - | Password for SASL authentication |
* = Conditionally required when using SASL authentication.
IAM authentication is not available in this target. Use SASL/SCRAM, by setting algorithm to scram-sha-512 or scram-sha-256, or mutual TLS, by setting tls.cert_name and tls.key_name. A cluster that accepts only IAM cannot be reached.
Producer Settings
| Field | Required | Default | Description |
|---|---|---|---|
compression | N | "none" | Message compression: none, gzip, snappy, lz4, zstd |
compression_level | N | - | Compression level (algorithm-specific) |
acknowledgments | N | "leader" | Acknowledgment level: none, leader, all. none and leader are silently upgraded to all unless disable_idempotent_write: true is also set — the idempotent producer is on by default and requires all |
allow_auto_topic_creation | N | false | Allow automatic topic creation if topic doesn't exist |
disable_idempotent_write | N | false | Turn off the idempotent producer. Required if you want acknowledgments to actually take effect as leader or none; leaving it false keeps exactly-once-per-partition write semantics |
Batch Configuration
| Field | Required | Default | Description |
|---|---|---|---|
max_bytes | N | 1048576 | Maximum batch size in bytes (0 = unlimited, max: 104857600) |
max_events | N | 1000 | Maximum number of events per batch |
batch_mode | N | individual | Output format: individual (one record per message), json_array (array of JSON objects), jsonl (JSON lines with separator) |
batch_separator | N | "," | Separator between messages when using jsonl batch mode. The console fills a real newline on a new jsonl target. The separator is written exactly as stored, never unescaped, so a two-character \n is sent as a backslash and an n |
field_format | N | - | Data normalization format. See applicable Normalization section |
Batches are sent when either max_bytes or max_events limit is reached, whichever comes first.
TLS Configuration
| Field | Required | Default | Description |
|---|---|---|---|
tls.status | N | false | Enable TLS/SSL encryption |
tls.insecure_skip_verify | N | false | Skip certificate verification (not recommended) |
tls.min_tls_version | N | tls1.2 | Minimum TLS version: tls1.0, tls1.1, tls1.2, tls1.3 |
tls.max_tls_version | N | tls1.3 | Maximum TLS version: tls1.0, tls1.1, tls1.2, tls1.3 |
tls.ca_name | N | - | CA bundle used to verify the broker certificate. When unset the host trust store is used; when set it replaces it |
tls.cert_name | N | "cert.pem" | Client certificate file name for mTLS |
tls.key_name | N | "key.pem" | Private key file name for mTLS |
tls.passphrase | N | - | Passphrase for encrypted private key |
Scheduling
See Scheduling and Pool Behavior for interval and cron fields shared by all targets.
Debug Options
| Field | Required | Default | Description |
|---|---|---|---|
debug.status | N | false | Enable debug logging |
debug.dont_send_logs | N | false | Process logs but don't send to target (testing) |
Details
Amazon MSK is a fully managed Apache Kafka service on AWS. This target type allows you to connect to MSK clusters using the standard Kafka protocol.
Authentication Methods
Two of the authentication methods an MSK cluster can offer are available here.
SASL/SCRAM Authentication
- User name and password, held for the cluster in AWS Secrets Manager
- Set
algorithmtoscram-sha-512orscram-sha-256, withusernameandpassword - Set
tls.status: true, since the SASL/SCRAM listener uses TLS
Mutual TLS Authentication
- A client certificate issued by the private certificate authority the cluster trusts
- Leave
algorithmatnoneand settls.status: true,tls.cert_nameandtls.key_name
Unauthenticated Access (plaintext)
- No credential is sent, and the traffic is not encrypted
- Set
algorithm: "none"and leavetls.statusatfalse - Not recommended for production
IAM authentication is not available in this target, so a cluster or a listener that accepts only IAM cannot be used. Take the port for the listener you choose from the Amazon MSK console, and set port explicitly.
Connection Requirements
MSK cluster bootstrap servers are available in the Amazon MSK Console. The address format is typically:
b-1.clustername.xxxxxx.kafka.region.amazonaws.com
For multi-broker clusters, you can use any broker from the bootstrap server list.
TLS Configuration
An MSK cluster exposes its plaintext, TLS and SASL/SCRAM listeners on separate ports, which are listed for your cluster in the Amazon MSK console.
Set tls.status: true for every listener except the plaintext one, and add tls.cert_name and tls.key_name when the cluster asks each client for a certificate.
Message Delivery Guarantees
The acknowledgments setting controls delivery guarantees:
| Level | Behavior | Use Case |
|---|---|---|
none | No acknowledgment from broker | Maximum throughput, lowest durability |
leader | Acknowledgment from partition leader only | Balanced throughput and durability |
all | Acknowledgment from all in-sync replicas | Maximum durability |
Compression
Message compression reduces network bandwidth and storage requirements:
| Algorithm | Compression Ratio | CPU Usage | Speed |
|---|---|---|---|
none | None | Minimal | Fastest |
gzip | High | High | Slow |
snappy | Medium | Low | Fast |
lz4 | Medium | Low | Fast |
zstd | High | Medium | Medium |
Examples
Basic Configuration (Unauthenticated)
The minimum configuration for an MSK target without authentication:
targets:
- name: basic_msk
type: amazonmsk
properties:
address: "b-1.mycluster.abc123.kafka.us-east-1.amazonaws.com"
port: 9092
topic: "application-logs"
algorithm: "none"
With SASL/SCRAM-SHA-512
Configuration using SASL/SCRAM-SHA-512 authentication:
targets:
- name: msk_sasl
type: amazonmsk
properties:
address: "b-1.mycluster.abc123.kafka.us-east-1.amazonaws.com"
port: 9094
topic: "authenticated-logs"
algorithm: "scram-sha-512"
username: "kafka-producer"
password: "stored-in-secrets-manager"
tls:
status: true
With SASL/SCRAM-SHA-256
Configuration using SASL/SCRAM-SHA-256 authentication:
targets:
- name: msk_scram256
type: amazonmsk
properties:
address: "b-1.mycluster.abc123.kafka.us-east-1.amazonaws.com"
port: 9094
topic: "secure-logs"
algorithm: "scram-sha-256"
username: "kafka-user"
password: "secure-password"
compression: "snappy"
tls:
status: true