There are mainly two types of retention in kafka.
1. Time based retention
2. Size based retention
For time based retention you can set the below properties in kafka broker properties file
# Configures retention time in milliseconds
# Configures retention time in minutes
# Used if log.retention.hours is not set
For size based retention you can set the below property in kafka broker properties file.
Check your file once and set the above properties. If it is not working, share your kafka broker properties file.