Managing log files
By default, IIS is configured to create a separate log file for each day. Unlike many other applications such as Exchange, IIS does not contain a native method of maintaining the number or size of the log files.
As IIS saves log files, the log files' sizes and number can quickly grow out of control. For instance, a web server that has been in production for a year can have 365 log files (one for each day) or more. A busy website or web service can potentially fill the OS drive of a server within a few weeks or months.
While this is a great repository of information, we don't want our logging to negatively impact the server. Chances are that if we need to review the files, we will only need the last few days or few weeks of files, and can remove anything older.
This recipe shows how to filter through the log files and remove those older than a certain date.
Getting ready
In this recipe we will be searching for any log files older than seven days and deleting them. When first...