Collapsing Empty Variables in Nginx Access Log When Using TAB Delimiter

adamchal nginx-forum at nginx.us
Tue Mar 6 19:00:45 UTC 2012


I'm noticing that Nginx's log module is "collapsing" empty log variables
primarily when using a TAB (\t) as a delimiter in the access log.

For example, if I use the following:

  log_format main
'$server_name	$msec	$remote_addr	$cookie_x	$cookie_y	$cookie_z	$status';

And a request does not have any cookies set (so $cookie_x, $cookie_y,
and $cookie_z would be empty), then I would get a log line like this:

myserver.com 1331049809.478	10.10.15.50	-	200

I was expecting:

myserver.com 1331049809.478	10.10.15.50	-	-	-	200

The same thing happens with the $http_referer (when not set by the UA)
and $upstream_addr (when serving static files).

Here's a link to my access log configuration:
https://gist.github.com/1988173

I'm using Nginx v1.1.16.

Has anyone experienced this before?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,223532,223532#msg-223532



More information about the nginx mailing list