locked
Download for Advanced Logging for IIS 7/7.5 No Longer Available RRS feed

  • Question

  • User983087641 posted

    I have a few servers still running Windows 2008 R2 & IIS 7.5, & I need to add the x-forwarded-for field to my IIS logs.  PowerShell's "Add-webConfigurationProperty" cmdlet added the field to my 2012 & 2019 servers, but I still do not have x-forwarded-for on my 2008 servers.   I did not get an error when I ran the cmdlet on my older servers, but the applicationHost.config was not updated. 

    I also checked Configuration Editor - I navigated to system.applicationHost/Sites/SiteDefaults/Logfile, but the section for "CustomFields" is not present.  I found multiple Microsoft documents that suggested installing Advanced Logging for IIS, but all the links for downloading the extension resulted in a 404 error.  

    What do I need to do to enable logging x-forwarded-for on Windows 2008 R2 / IIS 7.5?

    Wednesday, May 26, 2021 8:06 PM

All replies

  • User690216013 posted

    Windows Server 2008 R2 has reached end of life, so you are not supposed to use it any more. That's why Microsoft removed all legacy documentation and bits.

    Thursday, May 27, 2021 2:53 AM
  • User1065476709 posted

    Hi Kat4Birds,

    Kat4Birds

    What do I need to do to enable logging x-forwarded-for on Windows 2008 R2 / IIS 7.5?

    You can try the following steps:

    1. Open IIS Manager
    2. On server, site or application level, double click “Advanced Logging
    3. In the action pane on right side, click “Enable Advanced Logging
    4. In the action pane, click “Edit Logging Fields
    5. In the new window, click “Add Field
    6. In “Add Logging Field” window, fill out the following fields:
    7. Field Name: X-Forwarded-ForSource type: Response HeaderSource name: X-Forwarded-For
    8. Click “OK
    9. In the middle pane, select the default log definition %COMPUTERNAME%-Server. Click “Edit Log Definition
    10. Click “Select Logging Fields” 
    11. Select “X-Forwarded-For” from the list. Click “OK
    12. Click “Apply” in the actions pane

    After these steps, wait for a new log file to be created. Column changes will be effective only after a new log file is created. You may need to generate some traffic to fill the current log file.

    And here is the PowerShell command to add X-Forwarded-For header at the server level.

    Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/sites/siteDefaults/logFile/customFields" -name "." -value @{logFieldName='X-Forwarded-For';sourceName='X-Forwarded-For';sourceType='RequestHeader'}

    Best regards,

    Sam

    Thursday, May 27, 2021 3:14 AM
  • User1423611123 posted

    I am currently facing the same issue as the OP, but I had to reply to your comment. The advanced logging that you are referring to? Is only possible through the installation of the advanced logging module, which has been removed. You instructions would only be helpful in the presence of the advanced logging module (The title of this thread).

    Thursday, May 27, 2021 2:28 PM