Automaticly compress all IIS log files on a server using gzip
A public IIS server produces lots of log files.
The total size may reach several 100 GB quiet fast.
If you collect and archive this information it is good idea to compress the files
before you download them.
By default the IIS uses rolling log files. The location and format of each site and service is stored
in the IIS metabase. IIS provides several interfaces derived from the
IADs Interface
to retrieve object properties such as the
LogFileDirectory.
This script helps you to compress the IIS log files automaticly. It enumerates all IIsWebServer, IIsFtpService
and IIsSmtpService objects and
determines their log file directory. In this directory it searches for files with the extension
.log. With the exception of the file with new latest modification time stamp all files
found are compressed using gzip.
gzip compresses the files to 5% of its original size. If you want to use another archive
tool you can simply exchange it in the following line in the script
The script language is
JScript and it has been
testet for Windows Server 2003.
Invoke the script from the command line with the following statement:
cscript //nologo compress-iis-logs.js
Using this command and with the help of the windows task scheduler you can easily automate the task.