How to Change the Log File Directory in IIS7

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.

Double-click the Logging icon.

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

When you’ve entered or chosen the new log directory click Apply.

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:\Sites\Default Web Site' -name logfile.directory "D:\IISLogs"
About Paul Cunningham

Paul is a Microsoft Exchange Server MVP and publisher of Exchange Server Pro. He also holds several Microsoft certifications including for Exchange Server 2007, 2010 and 2013. Connect with Paul on Twitter and Google+.

Comments

  1. Surfer Joe says:

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

  2. internetrush says:

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

  3. internetrush says:

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

  4. dominique says:

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

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

      I’ve just retested to confirm that. At least on my own server it is working that way.

  5. 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.

Leave a Comment

*

We are an Authorized DigiCert™ SSL Partner.