private void cleanupLogs ( ) throws IOException { logger . trace ( "Beginning log cleanup..." ) ; int total = 0 ; Iterator < Log > iter = getLogIterator ( ) ; long startMs = System . currentTimeMillis ( ) ; while ( iter . hasNext ( ) ) { Log log = iter . next ( ) ; total += cleanupExpiredSegments ( log ) + cleanupSegmentsToMaintainSize ( log ) ; } if ( total > 0 ) { logger . warn ( "Log cleanup completed. " + total + " files deleted in " + ( System . currentTimeMillis ( ) - startMs ) / 1000 + " seconds" ) ; } else { logger . trace ( "Log cleanup completed. " + total + " files deleted in " + ( System . currentTimeMillis ( ) - startMs ) / 1000 + " seconds" ) ; } }
Runs through the log removing segments older than a certain age