We want to delete topics that are no longer being used and no producer has published for a long time.
Is it possible to list all topics in Lenses that have very old data and then delete them?
Or otherwise just sort all Kafka topics based on timestamp of the events?
It’s possible to filter by empty topics but currently not possible to see/list old topics.
You could do this maybe with the Lenses CLI which queries the first event in each topic and gets the timestamp. Such as:
#!/bin/bash
topics=`./lenses-cli topics | awk 'NR>2 {print $1}'`
for topic in $topics
do
echo $topic `./lenses-cli query "SELECT _meta.timestamp as ts FROM $topic LIMIT 1" | jq .ts`
done
output:
This solution only relevant if the timestamp is the Ingestion time of the event.