Skip to content

Instantly share code, notes, and snippets.

@maakuth
Created June 21, 2023 09:58
Show Gist options
  • Save maakuth/451f5802a9340fcb6cfb637169a6a554 to your computer and use it in GitHub Desktop.
Save maakuth/451f5802a9340fcb6cfb637169a6a554 to your computer and use it in GitHub Desktop.
Kcat timestamp parser
#!/usr/bin/env python3
# Use with kcat -f "%p,%o,%T\n" to parse message timestamps
from sys import argv
from datetime import datetime
import csv
for row in csv.reader(open(argv[1], 'r'), delimiter=','):
print(f"Partition {row[0]} offset {row[1]}: {datetime.fromtimestamp(int(row[2])/1000)}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment