Link to home
Start Free TrialLog in
Avatar of Texal
Texal

asked on

Deleting IIS logs in C:\WINNT\system32\LogFiles\W3SVC1

Hi all,

We currently have a system drive that is approaching capacity very rapidly. The space is being used by IIS log files being created in the following directory:
C:\WINNT\system32\LogFiles\W3SVC1

Is there anyway to safely delete these logs and then prevent this from reoccurring?

Any suggestions would be greatly appreciated.

Texal
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Yes, delete them.  Done.  Of course, I'd recommend MOVING them instead to another partition or to a CD or something.

You can also change the location of where IIS stores it log data by opening up the Internet Information Services MMC control panel.  Then right clicking on your default web site, and on the Web Site Tab, click the Properties button in the "Enable Logging" section.  In the window that appears, provide a new path for the log files.
you can delete or rotate logs using a simple batch script, put it somewhere handy like c:\batch\ or such:

---------START contents rotate.bat----------
del C:\WINNT\system32\LogFiles\W3SVC1\7
rmdir C:\WINNT\system32\LogFiles\W3SVC1\7
rename C:\WINNT\system32\LogFiles\W3SVC1\6 7
rename C:\WINNT\system32\LogFiles\W3SVC1\5 6
rename C:\WINNT\system32\LogFiles\W3SVC1\4 5
rename C:\WINNT\system32\LogFiles\W3SVC1\3 4
rename C:\WINNT\system32\LogFiles\W3SVC1\2 3
rename C:\WINNT\system32\LogFiles\W3SVC1\1 2
mkdir C:\WINNT\system32\LogFiles\W3SVC1\1
move C:\WINNT\system32\LogFiles\W3SVC1\*.log C:\WINNT\system32\LogFiles\W3SVC1\1
---------END contents rotate.bat----------

then set it up to run daily (or weekly or monthly or whatever):

at 01:30:00 /every:M,T,W,Th,F,Sa,Su c:\batch\rotate.bat

you can easily change the number of subdirectories to how many you want to keep.

cheers.
ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sure, i tend to agree with leew.

unless they are massive (ie several gigs a day) then i, too, think that keeping them is a good idea.

Any way to change where these are stored by defauilt?
Also, if space is a concern, install Winrar and zip them up. That is what we do for archiving purposes. We zip them into individual files and then delete the original. Very simple to do and the compression is VERY NICE! (Borat voice)