How to Configure Enhanced Logging for IIS 8.5?

0
8054

With so many IIS versions so far, configuring enhanced logging for IIS 8.5 is only available in IIS 8.5. IIS on Windows Server 2012 has some configurable features, but very limited logging capabilities are provided with this logging system. For example, a fixed set of standard fields makes you have no choice of extensibility or customizability when logging.

However, adding additional custom fields for blogging in IIS 8.5 can be achieved from 3 source types – request header, response headers and server variables. Therefore, administrators who want to log fields with more capabilities need to add a custom filed. In the previous time, we developed an article on how to log into Event Tracing for Windows in IIS 8.5. Today, we will talk about how to configure enhanced logging for IIS 8.5.

Here are instructions.

1. Find the IIS Manager and open it.

2. In the “Connections” pane, select the server or site under “One log file per” and click the “Logging” twice. Pay attention: the enhanced logging is only available for site, so don’t choose the server, or the “Custom Fields” section in the “W3C Logging Fields” window will be disabled.

3. Under the “Format” section, select W3C from the list and click the ” Select Fields….” button.

Configure enhanced logging for IIS 8.5-1

4. Here comes the “W3C Logging Fields” window as below, click the “Add Field….” button. As we mentioned, the enhanced logging is only available for site, so don’t select the server, or “Add Field…” in the “W3C Logging Fields” window will be disabled.

Configure enhanced logging for IIS 8.5-2

5. Now comes the “Add Custom Field” window. First, enter the name of the field under the “Field Name”. Note that spaces cannot be contained in the field name.

6. Then, select a source type. There are 3 choices at your options: Request Header, Response Header and Server Variable. Please note that a server variable with a name that comprises lower-case characters cannot be logged in the event log by enhanced logging, so you should make sure that its name comprises all upper-case characters.

7. The next part is “Source”. The source you select should depend on the source type you chose.  Also, you can enter a custom source string instead. With all the steps done, click the “OK” button.

Configure enhanced logging for IIS 8.5-3

8. Every time you want to add an additional custom field, you just need to click “Add Field…”. If you want to remove or edit a custom field you have added, you can click “Remove Field” or “Edit Field… “.

9. After you have added all the needed fields, click “OK”. Finally, click the “Apply” button in the “Actions” pane to have the new configuration applied.

Once you apply the configuration, new text log files with “_x” attached to the file name will be generated, indicating that custom fields are contained in the file. Pay attention that the total size of data added from all custom fields is no more than 65,536 bytes, or the data will be truncated by IIS.