On an Exchange Server 2010 Client Access server a lot of logging can be generated by IIS for client traffic such as OWA and ActiveSync.

For some servers the need to retain this logging for a long time may cause a disk space issue. To resolve this you can simply change the log file directory that IIS7 uses.

Open IIS Manager from Administrative Tools and click on the Default Web Site.

How to Change the Log File Directory in IIS7

Double-click the Logging icon.

How to Change the Log File Directory in IIS7

Type in the path to the new log directory that you want to use, or click Browse and navigate to it.

How to Change the Log File Directory in IIS7When you’ve entered or chosen the new log directory click Apply.

How to Change the Log File Directory in IIS7

The new directory will be created (if it doesn’t already exist) when the next log entries are written by the server.

You can copy the existing logs from the old location to the new log directory. Just be aware that the server may have already created a log file in the new directory for the current day, but you can simply tell the copy to keep both files by renaming one of them. Or if you make the change during a period of the day that there is no activity then you probably won’t run into any duplicate file name issues.

We can also make the same configuration change using Powershell. From a Powershell window type the following commands.

PS C:\> Import-Module WebAdministration

PS C:\> Set-ItemProperty 'IIS:SitesDefault Web Site' -name logfile.directory "D:IISLogs"

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Val Suarez

    Actually, you only have to restart the website in order for the new log file location to take affect. Add a line to your script to bounce the site and voila!!! I recommend creating a folder structure as follows: d:\IIS LOG FILES\WEBSITE NAME. A folder will get created inside of the WEBSITE NAME folder but at least you know which site you are looking at.

  2. Bryan McGill

    For me in IIS 8.5 the httperr logs location persisted to the old location after I made a location change in IIS at the server level. The sites were logging to the new location, but not the httperr log. WinServer 2012 R2.
    I restarted IIS at least twice. I verified the sites retained the new logs location and the server level as well.
    I checked hklm:SystemCurrentControlSetserviceshttpparameters
    ErrorLoggingDir was still set to the old location. I rebooted the server. Same results.

    I looked everywhere to try and find a setting to update this registry value and did not find anything.
    I saved a backup of my registry and then updated the setting manually.
    I reset IIS. Still did not update.
    I rebooted the server. Finally. The httperr log was created and logging to my new location.

  3. zohaib

    How can i got session id in IIS log file . is there any custom field adding that guage the sessions or any other way to find out the no of session

    Many thanks

  4. Kirt

    IIS restart was required. Did it twice to verify IIS restart is required. Each time I changed the log location and tested I got 500 error until I restarted IIS.

  5. dominique

    Same question here!!!
    Does IIS have to be restarted for this to take effect? I do not see a change using the powershell commands.

  6. internetrush

    Also, how do you change the Master (servername) default logging location for IIS?

    1. Barbi

      That’s not just the best anwers. It’s the bestest answer!

  7. internetrush

    Does IIS have to be restarted for this to take effect? I do not see a change using the powershell commands.

    1. Ricardo Fuentes

      No, it doesn’t require a IIS reset.

  8. Surfer Joe

    Dude, how can I get rename W3SVC6, etc. to the name of the site in IIS?

Leave a Reply