At Kafka there is currently no way to get an offset corresponding to a specific timestamp - this is by design. As described at the top of the Jay Kreps Log Article , the offset number provides a kind of timestamp for the magazine, which is separated from the wall clock time. Using bias, as your concept of time, you can know if any two systems are in a consistent state, just buy, knowing what bias they read before. There is never any confusion regarding different clocks on different servers, leap years, daytime, time zones, etc. It is very cute...
NOW ... all that said, if you know that your server went down at some time X, then, in fact, you really would like to know the corresponding offset. You can get closer. The log files on kafka machines are named according to the time they started writing, and there is a kafka tool (which I canβt find right now) so that you know what offsets are associated with these files. If you want to know the exact timestamp, then you must encode the timestamp in the messages you send to Kafka.
source share