hdjur_jcv
hdjur_jcv

Reputation: 746

How to see a topic creation and alteration timestamp in Kafka

Or at least one of them? I don't get it when I use kafka-topics.sh --list or --describe, perhaps I'm missing the option for verbosity, although I don't see them in the attribute list for topic configuration at all. Is it not sensible information with Kafka?

Upvotes: 4

Views: 3325

Answers (2)

Nishu Tayal
Nishu Tayal

Reputation: 20840

You can see the Kafka topic creation time(ctime) and last modified time(mtime) in zookeeper stat.

First login to zookeeper shell

kafka % bin/zookeeper-shell.sh localhost:2181 stat /brokers/topics/test-events

It will return below details:

Connecting to localhost:2181

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
cZxid = 0x1007ac74c
ctime = Thu Nov 01 10:38:39 UTC 2018
mZxid = 0x4000f6e26
mtime = Mon Jan 07 05:22:25 UTC 2019
pZxid = 0x1007ac74d
cversion = 1
dataVersion = 8
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 112
numChildren = 1

You can refer this to understand the attributes : https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_zkStatStructure

Upvotes: 4

ssice
ssice

Reputation: 3683

Kafka does not publicly state the date of topic creation/alteration.

The timing data itself is not required by Kafka to work. The current topic config values are kept by the Zookeeper ensemble that the whole Kafka cluster requires to function, so it's kept in-sync by the underlying zookeeper process, and for the part that Kafka is required to syncrhonize, only the offsets within the topic are required to partially-order the messages as they come, the timestamp is not required information.

If you want to keep topic modifications actionable, maybe your best bet is to have a Kafka topic to save such modifications so that you can later read it.

Upvotes: 1

Related Questions