Discussion Locked

IIS4 log file backup

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'd like to get hold of some scripts or software to automatically compress my IIS log files from .log to .zip file format when the reach about 15MB in size.

Please advice.

Thanks in adv. for being helful.

3 replies

by shanghai sam

Winzip version 8.0 and above have a recent addition, WZZIP, which is a command-line version. Basically it is just like the old standard, PKZIP, but is is from the Winzip people. You can get WZZIP as a add-on to Winzip:
http://www.winzip.com/wzcline.htm

So, here is something you can do. Write a BAT file that calls WZZIP and has it compress all of your .LOG files. It could look like this:

@echo off
for /f "tokens=1-7 delims=: " %%i in ('now.exe') do set iislogs=%%j%%k%%o%%l%%m%%n%%i
"c:\program files\winzip\wzzip.exe" %iislogs%.zip *.log
del *.log

NOTE: I am using a file from the NT Resource Kit called NOW.EXE. NOW will give you the date and time all in one string. I use this piece of script to generate a variable with a value of Jan182002174257Fri, for example; so when I run the BAT file above, I get a ZIP file with the file name of Jan182002174257Fri.zip. This is a good way to keep files date and time sorted in the file name itself. You can download NOW.EXE from Microsoft.

Ok. Place this BAT file in the IIS log file directory (as well as NOW.EXE) and run it from there (just to make the pathing easier; I am lazy when it comes to proper pathing in BAT files!). Set up a Schedule Job to run the BAT file every day or however often you need to back up your LOG files.

Hope this helps.

This discussion is closed to new replies.