ksqlDB includes the PRINT statement for inspecting the contents of a Kafka topic from the ksqlDB CLI. It is useful when troubleshooting a topic or quickly checking whether records are arriving.
Quick answer: Use PRINT to display topic records. By default, it starts with the most recent messages; add FROM BEGINNING to read from the first message, LIMIT to stop after a number of messages, or INTERVAL to print every nth message.
Print Kafka topic messages
Print messages arriving from the topic:
PRINT 'name.of.the.topic';
By default, PRINT starts with the most recent messages. To read the topic from the beginning:
PRINT 'name.of.the.topic' FROM BEGINNING;
Print only the first five messages:
PRINT 'name.of.the.topic' FROM BEGINNING LIMIT 5;
Print every 100th message and stop after five messages:
PRINT 'name.of.the.topic' FROM BEGINNING INTERVAL 100 LIMIT 5;
The current ksqlDB syntax is PRINT topicName [FROM BEGINNING] [INTERVAL | SAMPLE interval] [LIMIT limit]. The topic name is case sensitive, so quote it when required.
Available on Microsoft Store
SSRS Reports Migration Wizard
A simple Windows tool for migrating SSRS reports, data sources, and related configurations between report servers.
Pro tips:
Use PRINT for quick topic inspection. If you need to process or filter records, use a ksqlDB stream/table query instead. For automated ksqlDB deployments, see our ksql-migrations guide.
Kunal Rathi
With over 15 years of experience in data engineering and analytics, I've assisted countless clients in gaining valuable insights from their data. As a dedicated supporter of Data, Cloud and DevOps, I'm excited to connect with individuals who share my passion for this field. If my work resonates with you, we can talk and collaborate.






