Skip to content

Instantly share code, notes, and snippets.



Last active Jan 17, 2020
What would you like to do?
Show last three messages from a Kafka topic with kafkacat
kafkacat -b localhost:9092 \
         -t _kafka-connect-group-01-status \
         -C \
         -o-3 \
         -c3 \
         -f 'Topic %t / Partition %p / Offset: %o / Timestamp: %T\nHeaders: %h\nKey (%K bytes): %k\nPayload (%S bytes): %s\n--\n'



Broker address


Topic name


Run as a consumer (-P for producer)


From offset (-o) three from the end (-3).


Consume three messages and exit (omit this to continue displaying new messages)


Optional format string to display rich information about the message and its metadata.

Useful when starting to poke around topic structures :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.