Answered inetpub\logs\logfiles\w3svc1 getting very large

  • Monday, December 28, 2009 7:11 PM
     
     

    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

Answers

  • Monday, December 28, 2009 8:02 PM
     
     Answered

    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
  • Tuesday, December 29, 2009 9:56 AM
     
     Answered
    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

All Replies

  • Monday, December 28, 2009 8:02 PM
     
     Answered

    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
  • Tuesday, December 29, 2009 9:56 AM
     
     Answered
    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
  • Saturday, April 24, 2010 10:50 AM
     
     

    Where can I disable this LOG? Is it necessary, I never use it...

    Thanks

  • Saturday, April 24, 2010 2:14 PM
     
     
    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
  • Thursday, July 22, 2010 5:22 PM
     
     
    Hey Tom, Just wanted to thank you for that handy little command there. Nicely done!
  • Saturday, August 07, 2010 4:42 AM
     
     Proposed Answer

    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
    •  
  • Monday, October 31, 2011 6:03 PM
     
     

    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, December 12, 2011 4:37 AM
     
     
    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/wordpress/?p=906


  • Friday, March 30, 2012 5:17 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 7:04 AM
     
     
    Read the second answer.

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

  • Monday, April 09, 2012 6:27 PM
     
     

    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 8:21 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:37 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

  • Tuesday, April 10, 2012 9:18 AM
     
     
    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 1:41 PM
     
     
    thx tom
  • Thursday, April 19, 2012 2:44 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\" 
  • Sunday, April 29, 2012 11:51 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