Jesoba.com is launched, Click below image to access it

Jesoba.com is launched, Click below image to access it
Technology and Entertainment Blog

How to move IIS 7 website log folder to another drive

How to move IIS 7 website log folder to another drive

Steps:
======

1: Copy website logs folder (W3SVC1572271583) from C: drive to another drive new location at D:\IIS Logs.
2: Change location of logs for website from IIS Manager from C:\inetpub\logs\logfiles to D:\IIS Logs,  
3: The next time when logs get generated they will generate under D:\IIS Logs\W3SVC1572271583 folder, remaining logs will not be affected\deleted.

Note:
=====

- After changing the log file location, the file at original location remain unchanged.
- When set new log file location no need to give sitename or siteid under logsfiles folder, it gets generated automatically if you are not moving orginial logs under logfiles folder.

Command to have log file on another disk drive next time onwards

%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/log -centralW3CLogFile.directory:"D:\IISLogs"

%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/sites -siteDefaults.logfile.directory:"D:\IISLogs"
%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/log -centralBinaryLogFile.directory:"D:\IISLogs"

Second, for your old sites, you can use appcmd to repoint the path or use IIS Manager. I find IIS Manager easier as it is just a cut-n-paste. However, If you want to use Appcmd, you can do it like such.

LIST ALL SITE NAMES to get the site names
%windir%\system32\inetsrv\appcmd list sites

Move the Logs to new location

Change LogPath for Default Web Site from default to D:\IISLogs
%windir%\system32\inetsrv\appcmd set config -section:sites -[name='Default Web Site'].logfile.directory:d:\IISLogs

No comments:

Google+ Badge

About Author

My photo

I am Senior Server Expert and Professional Blogger.