Improvements to log cleanup efficiency

This patch improves the efficiency of log cleanup. The code iterates
through all the logfiles in a directory after sorting by date and checks
against various thresholds. The code will now break out of the loop as
soon as it can (which is OK since the files are sorted).