We have an httpd.conf that contains the following log format and uses the %u token for logging the remote user:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
CustomLog "|/usr/sbin/rotatelogs /var/log/httpd/access.log.%Y%m%d 86400" combined

Unfortunately, no user identifier ever appears in the access log. The third token in every logged line just contains a hyphen instead of the user, like this: - - [20/Apr/2018:12:06:49 +0200] "GET /some/resource" ...

Does anyone know how the value of %u is set by Apache? Is there a particular HTTP header for which %u is replaced? I explicitly set a few headers like X-Remote-User, Remote-User or just User, but I keep just seeing hyphens...

Any clues about how Apache sets the %u would be highly appreciated.


This field corresponds to a username used in Authorization HTTP header used for The 'Basic' HTTP Authentication Scheme.

  • I actually see Authorization headers, too. We have two levels of Apache proxies, the first one does the authorization and the second one just 'reroutes' traffic to different application servers/backends. On the first proxy, the user IDs are all logged as expected, but on the second one they are not.
    – dokaspar
    Apr 20 '18 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.