Follow the steps below to add X-Forwarded-For column into IIS 8.5 logs:
- Open IIS Manager.
- On server, site or application level, double click Logging.
- Click Select Fields.
- In W3C Logging Fields window, click Add Field.
- In the Add Custom Field window, fill out the following fields:
- Field Name: X-Forwarded-For
- Source type: Request Header
- Source: X-Forwarded-For
- Click OK in both open windows.
- Click Apply in the actions pane.
Wait for a new log file to be created in the logs folder. Column changes will be effective when a new log file is created.
Command Line
%systemroot%\system32\inetsrv\APPCMD.EXE set config -section:system.applicationHost/sites /+"[name='Default Web Site'].logFile.customFields.[logFieldName='X-Forwarded-For',sourceName='X-Forwarded-For',sourceType='RequestHeader']" /commit:apphost