[ https://issues.apache.org/jira/browse/KAFKA-12555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17318172#comment-17318172 ]
Alexander Daskalov commented on KAFKA-12555: -------------------------------------------- Actually, looking closer at the current debug line: debug(s"Rolling new log segment (log_size = ${segment.size}/${config.segmentSize}}, " + s"offset_index_size = ${segment.offsetIndex.entries}/${segment.offsetIndex.maxEntries}, " + s"time_index_size = ${segment.timeIndex.entries}/${segment.timeIndex.maxEntries}, " + s"inactive_time_ms = ${segment.timeWaitedForRoll(now, maxTimestampInMessages)}/${config.segmentMs - segment.rollJitterMs}).") It is already debugging the reason to roll. Each entry in the log (log_size, offset_index_size, time_index_size,inactive_time_ms) print the current and the max value, so you can see what was the reason by checking which current value is above the max value. For example in the line {code:java} Rolling new log segment (log_size = 90/140}, offset_index_size = 0/1310720, time_index_size = 1/873813, inactive_time_ms = 12357342468/100{code} you can tell the reason is because of exceeding time. However, there is 1 rolling condition which is missing and that's when offsets can't be converted to relative offsets. So i'd suggest adding to the log {code:java} s"offset_convertible_to_relative = ${segment.canConvertToRelativeOffset(appendInfo.lastOffset)})."){code} in order to have all 5 reasons in the existing log > Log reason for rolling a segment > -------------------------------- > > Key: KAFKA-12555 > URL: https://issues.apache.org/jira/browse/KAFKA-12555 > Project: Kafka > Issue Type: Improvement > Reporter: Stanislav Kozlovski > Assignee: Alexander Daskalov > Priority: Minor > Labels: newbie > > It would be useful for issue-diagnostic purposes to log the reason for why a > log segment was rolled > (https://github.com/apache/kafka/blob/e840b03a026ddb9a67a15a164d877545130d6e17/core/src/main/scala/kafka/log/Log.scala#L2069) -- This message was sent by Atlassian Jira (v8.3.4#803005)