DEV Community

loading...

Discussion on: Learn how to use Kafkacat – the most versatile Kafka CLI client

Collapse
rakgenius profile image
Rakesh

How do I display all the topics in kafka?

Collapse
de_maric profile image
Dejan Maric Author

Hi Rakesh,
You could use a -L option without topic parameter. That will list all the topics. Do note that it will also list topic partitions. For this job I would rather recommend kafka-topics command:

kafka-topics --bootstrap-server localhost:9092 --list
Collapse
rmoff profile image
Robin Moffatt

You can also do it using the JSON output and filter it with jq:

kafkacat -b broker:29092 -L -J | \
  jq '.topics[].topic'|
  sort
Enter fullscreen mode Exit fullscreen mode
Forem Open with the Forem app