Exchange Server 2013/2016 EWS Logging Configuration
Up until Mid/Late Exchange 2010, all EWS logging was saved in the query string field in IIS logs. However, due to the amount of logging that is sometimes needed for troubleshooting etc., the location was moved. This allowed more detailed logging without unnecessarily bloating the single IIS log field. The new default location is as follows:
\ExchangeInstallPath\V15\Logging\EWS
Which if the default installation on the system drive looks like this:
C:\Program Files\Microsoft\Exchange Server\V15\Logging\Ews
For most installations this is usually fine because these are automatically purged based on age and/or size. However, if your organization depends heavily on EWS AND needs to troubleshoot, this may not be an ideal location. Let's consider a scenario where the logs are being recycled too quickly to be helpful such as you have an intermittent issue but by the time the issue is reported the logs we care about have been purged.
The good news is we have some control over where the logs reside as well as some additional control on how the logs are generated. Let's take quick look at these settings, all of which reside in the EWS web.config file:
MaxLogRetentionInDays
The age of the log(s) in days before deletion. Default: 30 Days
MaxLogDirectorySizeInGB
The maximum size in GB of the 'directory' the log files are stored in before files are cleaned up. Default: 5GB
MaxLogFileSizeInMB
The maximum size a single EWS log can grow before it is closed and new log is started. Default: 10MB
RequestDetailsLogger.EWSProtocolLogFolder
The path on disk where the logs are stored. Default: Exchange install path logging folder.
So, that's a decent amount of control of our logs. Here is the location of the web.config file for EWS that controls them.
\ExchangeInstallPath\V15\ClientAccess\exchweb\ews\web.config
Or the full path if installed on the system drive
C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\exchweb\ews\web.config
There are two ways to modify this file; we can edit it directly or just add the settings in the IIS 7.5 management console.
** NOTE **
Make a backup of the web.config! Any typo's or errors will cause IIS (specifically the EWS services application pool) to fail during startup which results in HTTP 500 errors. Until the errors are corrected and the app pool can successfully parse the XML file, EWS will not be functional! This includes case-sensitivity FYI.
Make the changes directly to the web.config
Make a backup copy of the web.config first.
Find the "<appSettings>" entry in the config file. Our settings go between <appSettings> and </appSettings>
For any setting we wish to change add the corresponding setting in the following format:
<add key="SettingName" value="SettingValue">
If we are changing the number of days we want the logs retained to two weeks, our entry would look like this:
<add key="MaxLogRetentionInDays" value="14">
Here are examples of the remaining settings:
<add key="MaxLogDirectorySizeInGB" value="3">
<add key="MaxLogFileSizeInMB" value="20">
<add key="RequestDetailsLogger.EWSProtocolLogFolder" value="D:\EWSLogs">Save the web.config file and recycle the services app pool. The changes will take effect as soon as the next EWS request comes in.
The result of the changes above are that we'll allow individual logs to grow to 20MB before rolling over to a new log and the directory can grow to 3GB before cleanup; our logs will now be saved @ D:\EWSLogs and/or any logs that are >14 days old will be purged.
Make the changes in IIS 7.5 management console
1. Open IIS 7.5 management console
2. Navigate to the "Exchange Backend" website.
4. Click on "EWS" in the Exchange Backend tree.
5. Double click "Application Settings" under "ASP.NET" in the right hand pane.
6. Either right-click in the main window where the existing settings are listed and choose "Add" or choose "Add" in the rightmost Actions pane.
7. Type the name of the setting and value, click OK.
8. As before, recycle the EWS application pool. (This can be found under "Application Pools" in the IIS management console and is named "MSExchangeServicesAppPool").
Comments
- Anonymous
July 15, 2016
Thanks