Internet Information Services (IIS) log files are like the Blob -- they just grow and grow. Unless you take steps...
to prune, archive or delete them entirely, they can gobble up a ridiculous amount of space on a server, especially if you’re using a hosted server with relatively little disk space.
Worst of all, because all this growth happens out of sight in a subdirectory that you might not be monitoring regularly, it can catch you off guard. It’s best to find a way to deal with IIS log files proactively so you’re not performing emergency cleanups at some ridiculous hour of the morning.
There are a couple of ways to approach this problem, such as writing a console script. After some casting around, however, I found a utility by Windows Server MVP Steve Schofield called IISLogs 2.0 that solves all these IIS log file problems and more in a highly-manageable way.
IISLogs lets you specify a number of different directories in which IIS log files are commonly saved, or a series of directory structures (a directory with subdirectories under it) that contain log files. Files older than a specified interval (the default is 48 hours) are compressed whenever the program’s main component is run, which can be done by hand or via the Windows Task Scheduler. You can also set up a background service version of the program and set it to perform maintenance at a specified time of day.
The configuration interface for IISLogs 2.0 has many options. For instance, admins have control over the depth of compression, the naming conventions for compressed files, the way IIS log files are handled after being compressed (typically, they’re deleted) and where the resulting compressed files are stored. After a cleanup job runs, an automatic email can provide admins with details about the job. Archives can also be automatically deleted after a certain interval.
In addition, administrators can set up extremely detailed per-directory behaviors in order to enforce different retention periods or compression behaviors. An “auto-add” option automatically inserts WWW / FTP / SMTP settings on the current server to be added to the configuration file. It’s also possible to process a few other file extensions automatically, including .XML, .TXT, .DAT and .BAK.
There’s still some room for improvement with IISLogs, though. For example, I’d like to see an option to automatically run a command-line operation before or after the logs are processed. (Note: It’s easy to do this if you’re scheduling IISLogs to run via Task Scheduler by adding those functions to a batch script, which also invokes IISLogs and runs said script as a scheduled task.) IISLogs would also benefit from a greater range of control over which file extensions can be processed, but the current batch should do the job for the vast majority of scenarios out there.
A free trial version of the program is available, but for use in a production environment you must buy a per-machine license, which starts at $29.95 per server.
You can follow SearchWindowsServer.com on Twitter @WindowsTT.
ABOUT THE AUTHOR
Serdar Yegulalp has been writing about computers and information technology for more than 15 years for a variety of publications, including InformationWeek and Windows Magazine.