0

I am trying to consume Kafka message using below options [format token as requirement]

kafkacat -C -b localhost:9092 -t test-topic -p 0 -f 'Topic %t [%p] at offset %o: key %k: %s\n' -o -1  -e | jq .

But getting below error,

Error: file/topic list only allowed in producer(-P)/kafkaconsumer(-G) mode

Usage: <path> <options> [file1 file2 .. | topic1 topic2 ..]]
kcat - Apache Kafka producer and consumer tool
https://github.com/edenhill/kcat

If I try above command without -f option then it works, but I want the formatted output. What would be the issue?

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137

1 Answers1

0

This has worked for me [root@vm-10-75-112-163 cloud-user]# kcat -b mybroker:9092 -t test1 -f 'Topic %t[%p], offset: %o, key: %k, payload: %S bytes: %s\n' -C Topic test1[0], offset: 0, key: , payload: 1 bytes: 1 Topic test1[0], offset: 1, key: , payload: 1 bytes: 2