Windows log file rotation

Yet another de facto Linux command that is oddly missing in Windows.

Some simple log files from a custom app were getting out of control. Google revealed that while basic rotation is possible for the standard Windows event logs, there’s no command in particular for log rotation, aside from some odd looking bat scripts that required typing output to temp directories and the like.

Tried rotatelogs.exe from the Windows distribution of Apache 2.2, but that didn’t seem to work at all.

Today, however, I stumbled across CHOMP. Works a peach, and surprisingly quick. Recommended.

(BTW, looks like the author has his own implementation of tail as well. Maybe this is the replacement for Cygwin tail that I was looking for last August..  Update:  It don’t work so well.)

2 thoughts on “Windows log file rotation

  1. Glad you liked chomp. I wrote it for my own webserver as I didn’t have much joy with LOGROTATE.EXE either – but one thing I really needed was to plonk the log files somewhere else (usually an ..oldlogs folder at the same level as “logs” ) – I’ve just modified the code to accept a target path for the new log files and also a /noerr switch to suppress all errors when using stdout redirection into a LST file for use with 7zip for log archiving/compression.

    Check it out. 🙂

  2. Try TailCGI instead, which runs as a tiny CGI app from Apache. (Requires Apache security set up) There’s also TailCMD which is a small, Win32 command-line version.

Leave a Reply

Your email address will not be published. Required fields are marked *