Editor's Note: Share your Windows and .NET discoveries, comments, problems, solutions, and experiences with products and reach out to other Windows & .NET Magazine readers (including Microsoft). Email your contributions (400 words or less) to r2r@winnetmag.com. Please include your phone number. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100. Submissions and listings are available online at http://www.winnetmag.com/articles. Enter the InstantDoc ID number in the InstantDoc ID text box.

Managing IIS Web Server Logs
Logging and occasionally monitoring your Web server activity is a good idea. To enable logging for all sites under a server, even sites that you create later, open the Microsoft Management Console (MMC) Internet Information Services snap-in. Right-click the server name, select Properties, and click Edit to open the WWW Service Master Properties for dialog box. Click the Web Site tab, and select the Enable Logging check box.

If you have a lot of traffic on your Web server, the log files will grow quickly and use all the space on the system partition because the default log file directory is \%windir%\system32\logfiles. You might want to move the log file to a partition with more space. After you select the Enable Logging check box, click Properties to set a new path.

Most Windows NT and Web administrators must also clean up the logs on their servers, a task that typically involves archiving or deleting old log files. You can use a script to manage this task efficiently. I scheduled the following .bat file to run at the beginning of each month:

: @echo off
: cd : cd batch\ziplogs
: for /d %%1 in (D:\logfiles\*) do del %%1\ *.zip
: for /d %%1 in (D:\logfiles\*) do pkzip %%1\%%~n1.zip
 %%1\*.log
: for /d %%1 in (D:\logfiles\*) do del %%1\*.log

The script looks for each set of log files in its own directory, then zips together the log files for the site and deletes the raw or plain (i.e., *.log) files. This script requires pkzip.exe.