in reply to Log rotating filter.

To guarantee that you never miss anything, this is what I've done on a similar sort of issue:

# I'll use psuedo-code since you did :^) while (my $line=<>) { print LOG $line; if ( ++$linenumber == 90% of max ) { LOG == LOG1 ? open LOG2 : open LOG1 } if ( $linenumber == max ) { LOG == LOG1 ? LOG = LOG2 : LOG = LOG1 LOG == LOG1 ? close LOG2 : close LOG1 LOG == LOG1 ? rename(LOG2) : rename(LOG1) $linenumber = 0 } }

Depending on how fast your logs fill up, you could push it up to as much as 98% of max before you bother to open the new log.