2016年9月21日 星期三

Windows Server 2008 with HTTP Default Web site running. Huge log file

https://social.technet.microsoft.com/Forums/systemcenter/en-US/d989b249-0159-41fc-b78c-1f1d91ce8bb3/inetpublogslogfilesw3svc1-getting-very-large?forum=configmgrgeneral

(extend read AT command)

Go To IIS console -> and Right click WebSite Property and click web site TAB find the Enable logging Next Step ->Uncheck the Enable Logging and restart the IISADMIN services after restart the service IIS log files are disbled



I trim mine with the following command which creates a scheduled task to do it :-

The mistake I found in Tom Watson's script is the added backslash \ before the Cmd.exe string resulting in the following:
ERROR: Invalid syntax. '/C' option is not allowed more than '1' time(s).
Type "FORFILES /?" for usage.
The fix, at least in my case was to remove the backslash \ as shown below.
Windows 2003  (if run now , cmd >  schtasks /RUN /TN "At1")
at 12:00 /EVERY:Su Forfiles.exe -p C:\WINDOWS\system32\LogFiles\W3SVC1 -m *.log -d -30 -c "Cmd.exe /C del @path\"

Windows 2008
at 12:00 /EVERY:Su Forfiles.exe -p C:\inetpub\logs\LogFiles\W3SVC1 -m *.log -d -30 -c "Cmd.exe /C del @path\"

This will run every Sunday, and will trim files in that folder older than 30 days.  Adjust to suit.

Regards,
Tom Watson,
E-Mail: Tom_... @...
Blog: http://myitforum.com/cs2/blogs/tom_watson
This was a great thread.  Cleared over 50 GB from a server today!  Thanks


沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。