none
inetpub\logs\logfiles\w3svc1 getting very large

    Question

  • We have recently built up an SCCM server and our "c drive" is filling up due to this directory, can we delete these files and if not how do we get this directory under control.
    We are running windows server 2008
    WSUS
    SCCM

    inetpub\logs\logfiles\w3svc1

    Monday, December 28, 2009 7:11 PM

Answers

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

    at 12:00 /EVERY:Su Forfiles.exe -p C:\WINDOWS\system32\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
    • Marked as answer by Yog Li Tuesday, July 27, 2010 10:31 AM
    Tuesday, December 29, 2009 9:56 AM
  • You can absolutely delete these log files or zip them or turn on NTFS compression. These log files are mainly for troubleshooting and reviewing security. If neither are of immediate interest to you, then turn off logging altogether or write a script to delete them periodically. It's not like ConfigMgr is actually hosting any critical business information and you should have other safe guards in place anyway.


    Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
    • Proposed as answer by Jason SandysMVP Monday, December 28, 2009 8:02 PM
    • Marked as answer by Yog Li Monday, January 04, 2010 10:33 AM
    Monday, December 28, 2009 8:02 PM

All replies

  • You can absolutely delete these log files or zip them or turn on NTFS compression. These log files are mainly for troubleshooting and reviewing security. If neither are of immediate interest to you, then turn off logging altogether or write a script to delete them periodically. It's not like ConfigMgr is actually hosting any critical business information and you should have other safe guards in place anyway.


    Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
    • Proposed as answer by Jason SandysMVP Monday, December 28, 2009 8:02 PM
    • Marked as answer by Yog Li Monday, January 04, 2010 10:33 AM
    Monday, December 28, 2009 8:02 PM
  • I trim mine with the following command which creates a scheduled task to do it :-

    at 12:00 /EVERY:Su Forfiles.exe -p C:\WINDOWS\system32\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
    • Marked as answer by Yog Li Tuesday, July 27, 2010 10:31 AM
    Tuesday, December 29, 2009 9:56 AM
  • Where can I disable this LOG? Is it necessary, I never use it...

    Thanks

    Saturday, April 24, 2010 10:50 AM
  • IIS logging is is enabled by default in IIs& ad IIS7.5 so I assume that you mean one of those: http://technet.microsoft.com/en-us/library/cc754631(WS.10).aspx.
    Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
    • Proposed as answer by Derek Lutz Monday, August 19, 2013 1:22 PM
    Saturday, April 24, 2010 2:14 PM
  • Hey Tom, Just wanted to thank you for that handy little command there. Nicely done!
    Thursday, July 22, 2010 5:22 PM
  • Here we can disable the IIS log files

    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

    • Proposed as answer by Narendra Bhatt Wednesday, February 09, 2011 10:01 AM
    Saturday, August 07, 2010 4:42 AM
  • This was a great help. I've created a post at http://www.itbangbang.net/2011/10/are-w3svc1-log-files-getting-very-large.html to pass on your information. Thanks!

    Monday, October 31, 2011 6:03 PM
  • I trim mine with the following command which creates a scheduled task to do it :-

    at 12:00 /EVERY:Su Forfiles.exe -p C:\WINDOWS\system32\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, 

    http://www.nickshertzer.com/?p=906




    Monday, December 12, 2011 4:37 AM
  • You suggest writing a script to delete or trim these unneeded inetpub log files. What would that script look like?

    Jan Vanderpool

    Friday, March 30, 2012 5:17 AM
  • Read the second answer.

    Regards,
    Tom Watson,
    E-Mail: Tom_...@...
    Blog: http://myitforum.com/cs2/blogs/tom_watson

    Friday, March 30, 2012 7:04 AM
  • i copied and pasted your forfiles.exe command on a 2008 windows server R2 and got the following error:

    C:\IISSEPM\W3SVC2>Forfiles.exe -p C:\IISSEPM\W3SVC2 -m *.log -d -30 -c \"Cmd.exe /C del @path\"
    ERROR: Invalid syntax. '/C' option is not allowed more than '1' time(s).
    Type "FORFILES /?" for usage.

    any ideas?

    thx in advance,

    pat

    Monday, April 09, 2012 6:27 PM
  • Make sure when you copy and paste that the double quotes aren't being replaced by smart quotes.

    Jason | http://blog.configmgrftw.com | Twitter @JasonSandys

    Monday, April 09, 2012 8:21 PM
  • not sure what "smart quotes" are - i tried substituting the quotes i had copied and pasted w/ double quotes typed in manually - no luck.

    i then removed the back slashes (\) and viola, it worked - no idea why.

    thx for your assistance.

    pat

    Monday, April 09, 2012 8:37 PM
  • The back slashes are required if you want to schedule the FORFILES.EXE command with AT.  If you were just running the command on its own, as you've discovered, you don't need the backslashes.

    Regards,
    Tom Watson,
    E-Mail: Tom_...@...
    Blog: http://myitforum.com/cs2/blogs/tom_watson

    Tuesday, April 10, 2012 9:18 AM
  • thx tom
    Tuesday, April 10, 2012 1:41 PM
  • Change the path. It is not the same on a 2008 server.  This is what you should use for 2008. at 12:00 /EVERY:Su Forfiles.exe -p C:\inetpub\logs\LogFiles\W3SVC1 -m *.log -d -30 -c \"Cmd.exe /C del @path\" 
    Thursday, April 19, 2012 2:44 PM
  • Tom sorry to be a pain but how do you create this script??

    Usually when i start ten tas it is asking for an application !

    TKS

    Sunday, April 29, 2012 11:51 PM
  • Do you know where this task will be created under scheduled tasks?

    Moo.

    Thursday, June 07, 2012 3:42 PM
  • Where to run this from?

    I started Task manager in SBS 2008, not sure of the commands there.

    Thanks


    Dennis Reist

    Thursday, November 08, 2012 3:07 PM
  • 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
    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\"

    Monday, February 04, 2013 10:02 PM
  • Hello,

    I was wondering is we can get both "daily" and "max size" of the W3SVC logs. Since we have enabled "daily" generation of logs, it gets up to 400MB, but seldom it reaches more than a GB, which is when we get issue in opening the log files in Server itself (in notepad, since we don't use 3rd party softwares to open log files). From GUI we can enable either of these two options. Is there something via command or else?

    Thanks !

    Wednesday, June 26, 2013 2:43 AM
  • Huh? This (ancient) thread is specific to System Center Configuration Manager and specifically discusses if the IIS logs are actually needed for anything. Not sure exactly what you want or how it relates.

    Jason | http://blog.configmgrftw.com

    Wednesday, June 26, 2013 9:59 PM
  • I trim mine with the following command which creates a scheduled task to do it :-

    at 12:00 /EVERY:Su Forfiles.exe -p C:\WINDOWS\system32\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

    Absolutely fantastic!   Win2008R2, Exch2010 works perfectly. Thanks Tom

    • Edited by Lee Cripps Friday, September 13, 2013 10:28 AM
    Friday, September 13, 2013 10:28 AM
  • Worked great!  Thank you so much!
    Tuesday, December 10, 2013 1:20 PM
  • I Can't use it for 2012, could you rewrite it for 2012 with schtasks util.
    Thursday, April 10, 2014 11:06 AM