Logging issue with Custom Log Field - 100 Sites or More

Dwayne 1 Reputation point

I am seeing a very strange occurrence with configuring an IIS custom log field. Another user on this forum reported the same issue last year, but was given an alternate solution with no explanation of why the original issue existed. A link to the user's post can be found below. To reiterate the issue, when adding a custom log field at the server level, the IIS log file does not show the custom field as a header, but it appears as a value in each log entry as shown in the example below (the x-forwarded-for is the custom field in example below). Also, the IIS log file does not contain the _x value in its file name (e.g. "u_ex220830_x.log").

Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-08-20 03:32:18
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2022-08-20 03:32:18 2000000064+x-forwarded-for+-+ comp-1234 GET /test.html - 80 - HTTP/1.1 GoogleHC/1.0 - - 500 0 0 383 121 3140

I did some extensive testing with adding web sites in IIS and applying the custom log field at the server level. I found that when a custom log field is added to the server level and there are 100 web sites or more in IIS, the above issue is manifested. When the number of sites are less than 100, then the custom log field appears as a header in the IIS log file and the log file shows an appended _x in its name.

I was able to apply an alternative fix to the issue by using a PowerShell script to apply the custom log field at each site level instead of the server level as mentioned in the post below. However, I am not able to find an explanation anywhere on the Internet as to why the logging issue happens when there are more than 100 sites in IIS.

Does anyone have an explanation for this occurrence? Is this a bug?

Thank You.

Original Post:

Internet Information Services
{count} votes