Purge iis logs files
To see a list of the available info we can collect with the help of this feature, we can visit this official page who documents the W3C Extended Log File Format , which Microsoft adopted since IIS 6. Like we said above, activating the logging feature is not a choice: a good administrator should always keep it enabled for a number of good reasons, including — yet not limiting to — statistical purposes.
Now that we acknowledged the importance of keeping the IIS logging enabled, we need to find a way to optimize the required HDD space that such a useful feature will take.
Just to make a quick example, this website — which has roughly In order to leverage the weight of the log files in terms of HDD space, we can activate the following workarounds:. The first thing we need to do is to locate the folder used by IIS to store all the log files.
This should be something like. See this article , or try searching the web, for how to set it up as a scheduled task. If you remove the comment symbol " ", it will print out all the files it would delete without actually deleting them.
In this article we will show you how to handle the IIS log files and automate the process of their deleting on Windows Server Administrator can change the path to the logs using the Internet Information Services IIS Manager snap-in by specifying the required directory in the Logging section of site settings. Thus, for the year it accumulated about 70 GB of logs! In case of exhaustion space on the servers system drive, system administrators are beginning to look for what takes so much space, and safely passed inetpub folder, because, at first glance, it has small size.
Double-click Logging. In the Directory text box, enter the full UNC path of the directory that you created on the remote server. In the Actions pane, click Apply , and then click OK. All Web sites within the directory should begin logging data to the remote share.
For more information, see Remote Logging. You can control disk usage of log files by running a script that automatically deletes log files that are older than a certain age.
Running this script in a scheduled task will keep the problem of a disk filling up under control without constant maintenance. The following VBScript will check the age of each log file in a folder and will delete any log file older than a specified age.
To customize the script for your purposes, simply change the name and path of the folder in line 1 of the script, and change the maximum age to the desired value in days, in line 2. The script above will scan all subfolders, so it will process logs for ALL sites in and under the folder specified. If you want to limit the process to just a single site, change the path appropriately.
To run the script manually, execute the following script in an administrator command line: cscript. Using a script to delete log files is a long-term, reliable solution to the problem of log files consuming disk space.
If you automate the process, as shown below, it doesn't require constant maintenance.
0コメント