What is the best way to check how many events are consumed by an application from a Kafka topic during a time window?
Currently I am doing this:
$ ./bin/kafka-console-consumer.sh --zookeeper zookeeper:2181 --topic topic --from-beginning | grep -i '2018-05-29' > kafka.out
$ wc -l kafka.out
Some issues:
- It requires a timestamp of some sort to be in the payload (this is okay in this case)
- It starts from the first offset so you need to wait some time for the file to populate, depending on the throughput of your topic
Any better ways to do this? Preferably command line as it is used for ad-hoc analysis.
I am using Kafka 0.10
but any answers for newer versions would also be good to know.
Thanks