Here’s a nice little tip to shrink or keep control of your IIS log files. While looking at a space issue on a server recently I noticed that their W3SVC3 (this might be different i.e. W3SVC1) log files were about 4-5Gb in size and contained thousands of log files.
17_03_2014_003

In order to cut these down, you can either delete them manually and leave the last 30 days worth or run either of these commands depending on how you want to manage the log files:

17_03_2014_001
Forfiles /P C:\WINDOWS\system32\LogFiles\W3SVC1 /S /M *.log /D -30 /C “cmd /c del @PATH” (Change “C:\WINDOWS\system32\LogFiles\W3SVC1” to where every your logs are located)

You can Schedule this to run say every 30 days to keep them in check by running the command below, this will create a scheduled task.
17_03_2014_002
at 12:00 /EVERY:Su Forfiles /P C:\WINDOWS\system32\LogFiles\W3SVC1 /S /M *.log /D -30 /C “cmd /c del /F @PATH”
(Change “C:\WINDOWS\system32\LogFiles\W3SVC1” to where every your logs are located)

Hope this gets you out of a sticky Quibble.