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 somehow? 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 it's 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.

link|improve this question

Is periodically restarting your service going to cause problems? Can the application send its output to a program, or a network socket? – Zoredache Feb 8 at 23:35
It can log to stdout, or to a named file. Possibility to restart - possible, not certain yet. – mfinni Feb 9 at 2:24
feedback

2 Answers

up vote 2 down vote accepted

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.

link|improve this answer
Not scared of Cygwin if it includes a good solution, although I'm always mindful of not using a cannon to swat a fly. – mfinni Apr 4 at 13:26
Sorry, gotta pull back my checkmark. I don't see logrotate in the catalog for the current Cygwin. It might build properly from source, but the MAKEFILE doesn't include anything for CYG or WIN. – mfinni Apr 4 at 13:42
@mfinni Alas, it's not in the package, although others have used it in Cygwin. =/ – WesleyDavid Apr 4 at 15:32
Sounds good to me – mfinni Apr 4 at 17:23
feedback

There are hundreds of scripts for log rotations this link at sapien is one such example.

link|improve this answer
That one specifically handles old (stale) files that are no longer being written to, which is a fairly easy case. I was looking for something to handle a single file. – mfinni Apr 4 at 20:33
Searching that forum for "logrotate" has 0 results. – mfinni Apr 4 at 20:34
Why would you search for logrotate? Do a search for rotate log files in windows. The "normal" (eg the one I've seen the most frequently) method is forfiles.exe -p "C:\logsfolder" -s -m *.log -d -31 -c "cmd /c del @path". Typically however moving in use logfiles fails since the file is in use, so a script has to be written to also close the file handle. typically text logfiles don't get rotated that often since they compress down often to a 10:1 ratio – Jim B Apr 5 at 13:41
Jim - I would look for the string "logrotate" because that's a Unix tool that has the functionality I'm looking for - rotating old entries out of a single file. The things you're describing are indeed simple to find, and specifically not what I'm looking for. – mfinni Apr 5 at 13:43
@mfinni OK I thought you wanted to chop the log up into 10 meg pieces and dump any over 24 hours old or with a filecount greater then 1000. I didn;t realize you specifically wanted logrotate since you said you wanted equivalents – Jim B Apr 6 at 1:04
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.