Cleanup IIS, FTP and other log files

If your server is exposed to the outside world acting as a web-server with a lot of websites, then IIS will be creating a lot of log files in the LogFiles directory. These log files can be safely deleted or backed up according to your compliance.

I came across a handy Windows script file (WaRmZip) that is an utility for cleaning, deleting, compressing and moving log files. You can download it at Winadmin tools web site: http://winadmin.forret.com/scripts/warmzip

This utility is to delete older IIS log files. Go to C:\Windows\System32\LogFiles  or C:\WINNT\system32\LogFiles directory on your server. The folder location will change based on the OS.  You may be surprised to find hundreds of files in each of the subfolders. Using the WaRmZip utility, you can remov these log files, and then schedule this batch file to run weekly or monthly.

eg:
waRmZip.wsf /r “C:\Inetpub\ftproot” /da:7 /df /dr /log:c:\Inetpub\ftp_cleanup.log
WaRmZip.wsf “C:\Windows\System32\LogFiles” /da:7 /r

In the second example, the da:7 option says to delete files older than 7 days, the /r option says to process all sub folders.

Once the script is ready, you can schedule it using windows scheduler and make it automatic. More script examples can be found on the winadmin site.

A GUI version of the similar tool can be found at http://www.iislogs.com/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s