Kafka转储日志消息未显示有效负载

时间:2019-02-25 16:23:48

标签: apache-kafka

我正在转储Kafka日志消息以查看日志文件中的内容。但是,它不显示任何有效载荷。

有人可以让我知道我做错了吗?

查看此

[gaurang.shah@hadoop_dev]$ cat 00000000000000000002.log
?B�i%f��i%f����������������testingD9�6pi%u%4i%u%4��������������$llllllllllll[gaurang.shah@hadoop_dev]$
[gaurang.shah@hadoop_dev]$ /usr/hdp/current/kafka-broker/bin/kafka-run-class.sh kafka.tools.DumpLogSegments --files 00000000000000000002.log --print-data-log
Dumping 00000000000000000002.log
Starting offset: 2
baseOffset: 2 lastOffset: 2 baseSequence: -1 lastSequence: -1 producerId: -1 producerEpoch: -1 partitionLeaderEpoch: 0 isTransactional: false position: 0 CreateTime: 1551110670527 isvalid: true size: 75 magic: 2 compresscodec: NONE crc: 507646879
baseOffset: 3 lastOffset: 3 baseSequence: -1 lastSequence: -1 producerId: -1 producerEpoch: -1 partitionLeaderEpoch: 0 isTransactional: false position: 75 CreateTime: 1551111628084 isvalid: true size: 80 magic: 2 compresscodec: NONE crc: 970929776

1 个答案:

答案 0 :(得分:1)

尝试使用以下命令:(添加--deep-iteration标志)

/usr/hdp/current/kafka-broker/bin/kafka-run-class.sh kafka.tools.DumpLogSegments --files 00000000000000000002.log --deep-iteration --print-data-log

从v2.0版本开始,当传递--print-data-log标志时,deep-iteration被默认启用。