Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current state:  Voting in progress Under discussion

Discussion thread: here

JIRA: KAFKA-6733

PR:  #8909 (based on #4807)

Motivation

ConsoleConsumer (kafka-console-consumer) is a very important debugging tool in Kafka. However, currently it cannot print offset, partition and headers of a Kafka record. So, during debugging session, if we need to know those information, we have to use kafka-dump-log, which require file system access to the Kafka broker hosts, or use custom application, like kafkacat. This KIP is proposing to rectify this issue.

...

Code Block
$ kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning --property print.partition=true --property print.key=true --property print.timestamp=true --property print.offset=true --property print.headers=true --property key.separator='|'

CreateTime:1592475472398|nullkey1|asdf3|0|3|h1=v1,h2=v2
|value1    <-- offset 3, partition 0
CreateTime:1592475472456|nullkey2|qwer4|0|4|NO_HEADERS|value2     <-- offset 4, partition 0



Proposed Changes

Add new properties to DefaultMessageFormatter as per the above:

...