A broker has a log.retention.hours property, which is set to a default value whenever a topic is created. When you want to make any changes to the configurations of a currently running topic with kafka-topics.sh, you’ll have to specify a topic-level property. For log retention time, the topic-level property is retention.ms. By default, it’s 7 days, but you can alter it with kafka-topics.sh –alter for versions up to 0.8.2 or with kafka-configs.sh –alter for versions after 0.10.2.
At the moment, you can’t change the retention period during runtime, but you’ll be able to do so soon.