Re: empty variable in access log

2020-11-30 Thread Frank Liu
BTW, if I set error_log to "warn", I do see: 2020/12/01 00:32:46 [warn] 7356#7356: *1 using uninitialized "test_var" variable while logging request, client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", host: "localhost" The confusion was whether those uninitialized variables should be logged

Re: empty variable in access log

2020-11-30 Thread Frank Liu
Thanks Maxim, If I understand correctly, the uninitialized custom variable is the same as a variable initialized as "". That's why we don't see "-", but only see "". Only internal variables will have the special "-" treatment. Frank On Mon, Nov 30, 2020 at 4:27 PM Maxim Dounin wrote: > Hello!

Re: empty variable in access log

2020-11-30 Thread Maxim Dounin
Hello! On Mon, Nov 30, 2020 at 03:26:59PM -0800, Frank Liu wrote: > ok, for testing, I removed the variable from the map, and add one line in a > 2-way SSL server config, to create a fresh new variable: > > set $test_var "test"; > > For a request without client cert (400), I see neither "test",

Re: empty variable in access log

2020-11-30 Thread Frank Liu
ok, for testing, I removed the variable from the map, and add one line in a 2-way SSL server config, to create a fresh new variable: set $test_var "test"; For a request without client cert (400), I see neither "test", nor "-" in the access log for $test_var. I only see blank, as if the $test_var

Re: empty variable in access log

2020-11-30 Thread Maxim Dounin
Hello! 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'

Re: empty variable in access log

2020-11-30 Thread Frank Liu
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. On Mon, Nov 30, 2020 at 5:28 AM Maxim Dounin wrote: > Hello! > > On Sun, Nov 29, 2020 at 05:35:19AM -0800, Fran

Re: empty variable in access log

2020-11-30 Thread Maxim Dounin
Hello! On Sun, Nov 29, 2020 at 05:35:19AM -0800, Frank Liu wrote: > If I create a variable, default to blank: > >map upstream_env $upstream_env { >default ""; >} > > and log it in access log (log_format has $upstream_env). I see a "-" in the > log file, which is as expected, but

empty variable in access log

2020-11-29 Thread Frank Liu
Hi, If I create a variable, default to blank: map upstream_env $upstream_env { default ""; } and log it in access log (log_format has $upstream_env). I see a "-" in the log file, which is as expected, but for a 2-way SSL virtual host, I don't see the "-", just blank. Is that a bug?