We have a huge logfile being written by a vendor's application. Let's assume the vendor won't do anything that we ask. Is there any way of rotating that logfile? We're looking at about 300 MB an hour being written - I'd much rather chunk that into 10 MB pieces, and let anything older than a day or over 1000 files fall off a cliff.
(I know I know, possible duplicate of How do you rotate apache logs on windows without interrupting service?)
Aha - the Chomp log was dead, but searching for "chomp logrotate" brought me to its new site. I'll give it a try tomorrow and reply if I like it. I'd still like to hear about software anyone else is using that works for this.
I haven't used it yet, but LogRotateWin is a native implementation of logrotate for Windows that looks promising. At least it doesn't require Cygwin.
As much as I wince at the suggestion, installing Cygwin is one of the very few options that you have available to you. From there, you can use
logrotate
.Try LogRotateWin
I've tried LogRotateWin over the last few days.
The projects seems somewhat abandoned and I've found a few bugs in just the little testing I've done. (E.g. some command line parameters that "--help" shows are not actually implemented. E.g. state tracking via logrotate.status statefile does not work for relative paths in logrotate.conf. Instead they ALWAYS get rotated. Not just when their time has come. So you can only use absolute paths.)
But the exe is just 40KB and it does have a few nice features. And I like that fact their mission statement is "The goal is to use the same command line parameters and files as the Linux version." I like it.
Usable example starter-batch and example conf file below.
Logging logrotate's output
Something of a meta-problem: how do you log the activities of logrotate itself? I wrapped the call to logrotate.exe in a batch file. It logs everything to a tempfile, then calls logrotate, then appends everything from the tempfile to a final logfile, then deletes that tempfile. And then that final logfile is then taken care of by logrotate.exe itself in the next run. I then run that starter-batch-file via Windows Task Scheduler.
Mega-dodgy but does the job.
Do-LogRotate.bat
:logrotate.conf
:Related reading: I've struggled with Apache Tomcat logs on Windows. This is what made me look into logrotatewin. https://stackoverflow.com/questions/19787279/where-to-configure-internal-tomcat7-stdout-stderr-log-files/54423803#54423803