When testing changes to a legacy codebase on a development system, my preferred method of testing is to set the system clock to a date in the past, eg
date -s '-7 days', I then playback some operations, check output and log files, and advance the date 1 day, then playback more operations, check output and logs, advance 1 day, and basically repeat this for as long as necessary.
After the initial journey into the past, but before playing back operations, I run this command to truncate log files that have modified dates in the future:
logs=$(find /var/log -type f -mtime -0); for log in $logs; do cat /dev/null > $log; done
This empties the log files, however what I'd really like is a way to delete "future entries" in files, under
/var/log/ and it's subdirs (
apache/mysql/...) that occurred after the server's current date.
Are there any utils/tools that will help to delete log entries from the future, rather than completely truncating files as I do at the moment.
I'm using Debian stable.