dnf install -y kcat
apt-get install kafkacat
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