Clearing (IIS Logfiles) Disk Space on Windows Servers

Although there are a number of techniques and places to look to clear disk space on a Windows server, including pruning SQL transaction logs, removing HIBERFIL.SYS, moving the pagefile to another drive, one of the most effective I’ve found has been removing HTTP logs that get accumulated daily (particularly if you have turned logging on, which is a good thing, except for the space that it takes – the logging is useful for troubleshooting something that has happened in the past and also, statistics software such as WebTrends and SmarterStats rely on these logs to produce their results).

 

Windows Server 2000/2003

  • Logfiles are here by default – %SystemDrive%windowssystem32logfiles

 

Windows Server 2008

  • The default location for IIS Logfiles has been moved here – %SystemDrive%inetpublogsLogFiles

 

If the customer doesn’t care about logging* (we still do, for troubleshooting), it is safe to delete all of the logfiles in the various subdirectories. And in some cases, for a server that has been logging every day and is very active with OWA, etc., there can be hundreds or thousands of logs from 10k to 5mb in size or more. I always sort the folder by date and then shift+delete all of the entries, *except* for the latest (today) as it will be locked (in use).

 

* If the customer is using IIS analytical software, those logs are very important to them. Particularly in the case of Internet facing, public websites, you may want to be more choosy about logs that you purge – perhaps only deleting those older than a year, etc.