3

I do not find a way to disable and delete log file at C:\inetpub\logs\LogFiles\W3SVC2\u_extend1.log

The file is extremely large about 50gb, I have tried to delete it as administrator, but got an error that the file is used by System.

I thought that this file is generated by IIS7, disabled IIS7 and logging, restarted Windows but still file is use. Please help?!

Volodymyr Molodets
  • 2,424
  • 9
  • 36
  • 52
Tomas
  • 447
  • 3
  • 8
  • 17

2 Answers2

3
  1. Stop the IIS Admin and World Wide Web Publishing services either via the command line or the services.msc console to unlock the file (obviously this will stop IIS, so if you are hosting production sites do this in a maintenance window).
  2. Delete the file.
  3. Configure logging options as documented by Microsoft.

If for some reason you still show it as in use, use Process Explorer to find the process using it. Select Find->File Handle or DLL and enter the file name.

phoebus
  • 8,380
  • 1
  • 31
  • 30
0

If you want to optimize the HDD space required to host IIS log files without resorting to delete them, I suggest you to implement the following best practices:

  • Open the IIS Manager > Logging and change the Log File generation frequency to Daily, so you will have 1 logfile for each day.
  • Activate the "compress file and folders" feature on that LogFile folder.
  • Setup a cleanup of files older than N days (30, 90 or 180 depending on your scenario) by using a batch file or a Powershell script (and a Scheduled Task to run it on daily basis).

See this other answer and/or read this post for more details regarding how to do these steps.

Darkseal
  • 251
  • 5
  • 11