empty variable in access log

Maxim Dounin mdounin at mdounin.ru
Mon Nov 30 22:46:06 UTC 2020


On Mon, Nov 30, 2020 at 02:04:35PM -0800, Frank Liu wrote:

> I may have mixed this with special upstream variables, eg:
> $upstream_http_something. When upstream response header doesn't existing,
> the variable was logged - in the nginx access logs.

When a variable value is not found, it's logged as "-", that's 
expected behaviour.  That's documented in the log_format directive 
description (http://nginx.org/r/log_format):

: If the variable value is not found, a hyphen (“-”) will be 
: logged.

This doesn't apply to found but empty values as in your example 

Maxim Dounin

More information about the nginx mailing list