in reply to Removing old records from log files
Not to put a stopper on some rather nice code, but if you're running a UNIX system (which I suspect you are), what about just using the logrotate command?
Rotate files on a hourly basis and be done with it! You can delete the old records, or just store them on disk.
If you're on Windows, Perl might be easier.