Kafka
Synopsis
Creates a collector that connects to Kafka brokers and consumes messages from specified topics. Supports authentication, TLS encryption, and multiple workers.
For details, see Appendix.
Schema
- id: <numeric>
name: <string>
description: <string>
type: kafka
tags: <string[]>
pipelines: <pipeline[]>
status: <boolean>
properties:
address: <string>
port: <numeric>
username: <string>
password: <string>
algorithm: <string>
kerberos_keytab: <string>
kerberos_principal: <string>
kerberos_realm: <string>
kerberos_kdc: <string>
kerberos_config: <string>
kerberos_service_name: <string>
group: <string>
topic: <string>
balancer: <string>
reuse: <boolean>
workers: <numeric>
event_split_rules: <string[]>
tls:
status: <boolean>
cert_name: <string>
key_name: <string>
passphrase: <string>
ca_name: <string>
min_tls_version: <string>
max_tls_version: <string>
insecure_skip_verify: <boolean>
Configuration
The following fields are used to define the device:
Device
| Field | Required | Default | Description |
|---|---|---|---|
id | Y | - | Unique numeric identifier |
name | Y | - | Device name |
description | N | - | Optional description |
type | Y | - | Must be kafka |
tags | N | - | Optional tags |
pipelines | N | - | Optional pre-processor pipelines |
status | N | true | Enable/disable the device |
Connection
| Field | Required | Default | Description |
|---|---|---|---|
address | N | "0.0.0.0" | Kafka broker address. One broker, or several separated by commas (e.g., "kafka1.example.com:9092,kafka2.example.com:9093"). Each entry may include a port; if omitted, the port field value is appended. See Brokers |
port | Y | - | Kafka broker port, used by every address entry that does not give its own. Required and greater than 0 even when every entry gives its own port |
username | N | - | SASL username |
password | N | - | SASL password |
algorithm | N | - | SASL mechanism: plain, scram-sha-256, scram-sha-512, or gssapi. Leave empty or set to none to disable authentication |
kerberos_keytab | N* | - | Keytab file path, or base64-encoded keytab content. Resolvable via ${ENV_VAR} or $secret{...} |
kerberos_principal | N | username | Client principal (user or user@REALM). Falls back to username when omitted |
kerberos_realm | N | - | Kerberos realm. Overrides the realm derived from the principal or krb5.conf |
kerberos_kdc | N* | - | Comma-separated KDC addresses (host[:port], default port 88) |
kerberos_config | N* | - | krb5.conf file path, or inline krb5.conf content. Generated from kerberos_realm and kerberos_kdc when omitted |
kerberos_service_name | N | "kafka" | Kafka broker service principal name (SPN) |
group | N | "vmetric" | Consumer group ID |
topic | Y | - | Topic to consume from |
balancer | N | "roundrobin" | Partition assignment strategy: cooperativesticky, range, roundrobin or sticky. Matched case-insensitively but without hyphens — an unrecognized value is not rejected, it silently becomes roundrobin |
* = Applies only when algorithm is gssapi. kerberos_keytab is required, along with either kerberos_kdc or kerberos_config.
Brokers
The device needs to reach only one broker. It learns the rest of the cluster from that broker, and tries the next broker in the list when it cannot reach the first.
| Entry | Becomes |
|---|---|
kafka1 | kafka1:<port> |
kafka1:9093 | kafka1:9093 |
::1 | [::1]:<port> |
[::1] | [::1]:<port> |
[::1]:9093 | [::1]:9093 |
| empty field | 0.0.0.0:<port>, the director's own host |
Spaces around entries are ignored, and empty entries are skipped. A port of 0 or less is refused with port field not valid.
A director that predates broker lists reads the whole address field as one host name, so a list does not connect. Upgrade the director before you enter more than one broker.
TLS
| Field | Required | Default | Description |
|---|---|---|---|
tls.status | N | false | Enable TLS encryption |
tls.cert_name | N* | cert.pem | Client certificate for mutual TLS |
tls.key_name | N* | key.pem | Client private key for mutual TLS |
tls.passphrase | N | - | Passphrase for an encrypted private key |
tls.ca_name | N | - | CA bundle used to verify the broker certificate. When unset, the host trust store is used. |
tls.min_tls_version | N | tls1.2 | Minimum accepted TLS version (tls1.0, tls1.1, tls1.2, tls1.3) |
tls.max_tls_version | N | - | Maximum accepted TLS version. When unset, the highest mutually supported version is negotiated. |
tls.insecure_skip_verify | N | false | Skip broker certificate verification. Use only for testing. |
* = For mutual TLS only, and the two go together. Only a broker that asks for client certificates needs them. With plain TLS, or with SASL over TLS (Confluent, Amazon MSK, Event Hubs, Aiven), the director only has to trust the broker's certificate, through tls.ca_name or the host trust store.
cert_name / key_name | Result |
|---|---|
| both set | that certificate and key |
| both empty (as the console saves them) | no client certificate |
| both left out of the YAML | the director's own cert.pem and key.pem when it has both, no client certificate when it has neither, refused when it has only one |
| one set, the other empty | refused with tls cert or key field not valid |
| one set, the other left out of the YAML | the other is the director's default file (cert.pem or key.pem), refused when the director does not have it |
The console marks both fields as optional and refuses one without the other.
TLS material fields (cert_name, key_name, ca_name, client_ca_name) accept any of the following:
- File name — resolved relative to the service root directory. Nested paths such as
certs/prod/server.pemare supported. - Absolute path — honored only if it resolves inside the service root. Any path that escapes the root is refused.
- Inline PEM content — used verbatim when the value contains
-----BEGIN. - Environment variable —
${ENV_VAR}. - Vault reference —
$secret{id=...}or$secret{store=...,ref=...}.
Performance
| Field | Required | Default | Description |
|---|---|---|---|
reuse | N | true | Caps workers at the number of CPU cores the host offers |
workers | N | 4 | Number of consumers to start, whether reuse is on or off. With reuse on, fewer start when the host has fewer CPU cores. 1 runs a single consumer |
max_buffer_size | N | 128MB | Ingest buffer admission cap. Also sizes this listener's ingest buffers: 3/8 of this value at start, growing to at most 3x |
max_buffer_size is the ingest-buffer admission cap. Left unset it is 128MB, whose buffers take 48 MiB of heap per listener worker at start and grow to at most 384 MiB as bursts need the room — and with reuse: true a device runs one worker per listener. Size strings are binary, and 32MB and 32MiB are exact synonyms.
See Listener Memory Sizing for the arithmetic, the sizing table, and what happens when the cap is exhausted.
Event Split Rules
| Field | Required | Default | Description |
|---|---|---|---|
event_split_rules | N | - | Ordered list of rule set keys that split each message into separate logs. See Event Split Rules |
Without rules, the device keeps each message whole, as one log, unless its split_mode splits it. With them, a message that holds many logs, such as a JSON array or several lines, is split as the device receives it, and every later count, the device's own included, counts the logs. A message is still acknowledged only after all of its logs are delivered. A condition reads the topic as source. Changing the list restarts the device; editing a rule set it uses does not.
Reading Position
The device keeps its reading position as the offsets of its consumer group (group) in Kafka. A delivered fetch only records the position it reached. The device saves the newest position with the broker once a second, when its group takes a partition away, and when it stops.
- Each save waits at most 30 seconds in all, including any wait for an earlier save. A save that fails or runs out of time is logged as
Can not commit records for <device>. Error: <reason>. - After a crash, the device reads again the records it had not delivered yet, as it always did. It also sends again the records delivered since its last save. Normally that is less than a second's worth. While saves fail, it is everything delivered since the last save that succeeded. These are duplicates, never a loss.
Earlier versions committed once per fetch, one commit at a time.
Examples
Basic
Creating a simple Kafka consumer... | |
Secure
Connecting with SASL authentication and TLS encryption... | |
Kerberos
Authenticating with Kerberos (GSSAPI) using a keytab and KDC... | |
High-Volume
Optimizing for throughput with multi-worker mode... | |
Consumer Groups
Configuring consumer group behavior... | |
Consumers in the same group must use compatible configuration settings.
Pipelines
Applying custom processing to messages... | |
Pipelines are processed sequentially, and can modify or drop messages before ingestion.