kcat
generic non-JVM producer and consumer for Apache Kafka
TLDR
Consume messages from topic
$ kcat -b [localhost:9092] -t [topic] -C
Produce message to topic$ echo "[message]" | kcat -b [localhost:9092] -t [topic] -P
List metadata$ kcat -b [localhost:9092] -L
Consume with custom format$ kcat -b [localhost:9092] -t [topic] -C -f '%k: %s\n'
Consume from beginning$ kcat -b [localhost:9092] -t [topic] -C -o beginning
Query watermarks$ kcat -b [localhost:9092] -t [topic] -Q
SYNOPSIS
kcat [options] mode
DESCRIPTION
kcat (formerly kafkacat) is a generic non-JVM producer and consumer for Apache Kafka. Written in C using librdkafka, it provides a lightweight CLI for interacting with Kafka clusters. It supports producing, consuming, listing metadata, querying offsets, and working with Avro/JSON payloads via Schema Registry.
PARAMETERS
-b brokers
Comma-separated Kafka broker list (host[:port]).-t topic
Topic to produce to or consume from.-p partition
Partition to produce to or consume from.-C
Consumer mode.-P
Producer mode.-L
Metadata list mode.-Q
Query offsets by timestamp.-G group
High-level consumer group (requires broker >= 0.9.0).-o offset
Starting offset (beginning, end, stored, or numeric; negative counts from end).-e
Exit after consuming the last message.-q
Quiet mode, no informational output.-f format
Output format string (e.g. `%t %p %o %k %s\n`).-J
Output messages in a JSON envelope.-K sep
Key delimiter for produce/consume.-D sep
Message delimiter (default newline).-X prop=val
Set a librdkafka configuration property.-F file
Read librdkafka config from file.
INSTALL
sudo apt install kcat
sudo dnf install kcat
sudo apk add kcat
brew install kcat
nix profile install nixpkgs#kcat
HISTORY
Originally named kafkacat, the tool was renamed to kcat in 2021 to align with upstream branding. Both names may still be present depending on the distribution's packaging.
SEE ALSO
kafka(1), kafkacat(1), kafka-topics(1)
