Skip to content

Instantly share code, notes, and snippets.

@yuri1969
Last active September 26, 2023 20:36
Show Gist options
  • Save yuri1969/dfed53557b47fedb7f38ac573815219c to your computer and use it in GitHub Desktop.
Save yuri1969/dfed53557b47fedb7f38ac573815219c to your computer and use it in GitHub Desktop.
kcat / kafkacat

Kcat

Installation

  • dnf install -y kcat
  • apt-get install kafkacat

Usage

Print broker info:

kcat -L -X security.protocol=ssl -b 'b-2.<broker>.amazonaws.com:9094'

List topic names:

kcat -L -X security.protocol=ssl -b 'b-2.<broker>.amazonaws.com:9094' | grep 'topic ' | awk '{ print $2; }' | tr -d '"' | grep -vP '^_'

Print sizes of the last 4k messages from topic:

kcat -L -X security.protocol=ssl -b 'b-2.<broker>.amazonaws.com:9094' -f '%t %o |%S|%s\n' -C -t '<topic>' -o -4000 -e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment