0
votes

Is there an option to delete kafka older messages than one hour in a topic. Need only last one hour messages in a topic. Kafka producer will accept messages in every minute into a topic. I need to consume last one hour data from the current topic. 1. is there an option to delete message that are older than one hour in a topic, need to keep less than one hour data in that topic 2. Is there an option to read last one hour data from a topic, topic have full of one day data

1

1 Answers

0
votes

You can set retention.ms on a single topic, or you can set log.retention.ms on the brokers to override the default retention of a week.

Otherwise, after Kafka 0.10.2, your consumers can also seek to an offset by a timestamp, so you'd have to lookup where to consume from based on the current time, minus an hour