System logs are pretty easy to deal with. Most administrators set them to overwrite themselves after a certain period of time – not that they take up much room to begin with.
Web server logs, however, are notorious for ballooning to many megabytes very quickly. Rather than let them proliferate and use up valuable disk space, most administrators prefer to pack them up and store them somewhere else.
This can be tedious work. Admins can't always pack up every single log. First of all, they need to leave the most current one alone, since it's probably still in use. They may also need to leave alone existing logs going back a certain length of time so third-party log analysis programs (e.g., Webalyzer) can continue to access them. Admins need not just a way to automate Web server log archiving, but a way to do it intelligently -- in other words, to archive only what they need and without inordinate action on the part of the user.
You can automate the Web server log archiving process by using scripts. One such log archiving script, written in VBScript, uses Microsoft's MAKECAB command to compress archive files, resulting in a net space savings of up to 95% per file. The script takes one parameter -- a time interval in days – and archives any log file older than the specified interval. You can use the -a switch with the script to describe where to move the compressed log file to. You don't need to supply a source directory; the script automatically attempts to determine where IIS keeps its log files.
The more advanced and more flexible IIS Log Archiver from BBPSoft can schedule itself to archive Web server logs, compress log files at different levels of compression and, if needed, archive only certain sites.
Parker Software Ltd. offers a tool called WhosOn. Now at Version 4, it is nominally a live Web stats analyzer, but it also has a built-in automatic Web server log archival utility. If you need a log analyzer and an archival tool, this is a good place to start.
Five back-end tasks Windows administrators should automate
Automating Active Directory maintenance
Automating Group Policy Object management tasks
Automating DNS management tasks
Automating full-system backups
Automating Web server log archiving
About the author: Serdar Yegulalp is editor of Windows Insight, (formerly the Windows Power Users Newsletter), a blog site devoted to hints, tips, tricks and news for users and administrators of Windows NT, Windows 2000, Windows XP, Windows Server 2003 and Vista. He has more than 12 years of Windows experience under his belt, and contributes regularly to SearchWinComputing.com and SearchSQLServer.com.
This was first published in December 2005