Original Publish Date - June 15, 2012
I just implemented the IIS Advanced Logging Module on my IIS 7.5 web servers. The installation and configuration went fairly smooth, there were a few hiccups while attempting to log each site to its own directory (article on that one coming soon), but overall I’m fairly happy with it. One issue that I ran into was trying to log the UserName of my clients in the log files. I enable the cs-username field, however, the entries were all NULL. My environment utilizes ASP.NET authentication.
I first found that I needed to change log field source type in the applicationHost.config file – (original link)
This resolved the problem for 2 of my sites, however, the remaining sites, configured the same, still logged NULL.
After scouring internet forums, I finally stumbled upon an article on Stack Overflow that pointed me in the right direction. Apparently, if the Application Pool is running in Classic mode, IIS performs a type of double authentication and therefore loses the UserName value before it can be logged. I tested this by changing one of the malfunctioning Application Pools to Integrated, and the username started logging.