<div dir="ltr"><div>BTW, if I set error_log to "warn", I do see:</div><div><br></div><div>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"</div><div><br></div><div>The confusion was whether those uninitialized variables should be logged as "-", or "" (as if it is initialized with ""). I mis-read your earlier comment "If the variable value is not found, a hyphen (“-”) will be logged.". I took it as "if variable is uninitialized, a hyphen is logged".<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 30, 2020 at 4:37 PM Frank Liu <<a href="mailto:gfrankliu@gmail.com">gfrankliu@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thanks Maxim,</div><div><br></div><div>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 "".</div><div>Only internal variables will have the special "-" treatment.</div><div><br></div><div>Frank</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 30, 2020 at 4:27 PM Maxim Dounin <<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello!<br>
<br>
On Mon, Nov 30, 2020 at 03:26:59PM -0800, Frank Liu wrote:<br>
<br>
> ok, for testing, I removed the variable from the map, and add one line in a<br>
> 2-way SSL server config, to create a fresh new variable:<br>
> <br>
> set $test_var "test";<br>
> <br>
> For a request without client cert (400), I see neither "test", nor "-" in<br>
> the access log for $test_var. I only see blank, as if the $test_var was set<br>
> to "".<br>
<br>
That's because variables defined due to "set" somewhere in the <br>
configuration default to "" with an optional warning <br>
(<a href="http://nginx.org/r/uninitialized_variable_warn" rel="noreferrer" target="_blank">http://nginx.org/r/uninitialized_variable_warn</a>).  And in your <br>
test the variable is uninitialized, as the set directive is not <br>
executed for the request in question.<br>
<br>
The "-" special value can be seen for various builtin variables, <br>
such as non-existing headers ($http_*, $sent_http_*, <br>
$upstream_http_*), non-existing arguments ($arg_*), cookies <br>
($cookie_*), $content_length if not available, $remote_user if not <br>
provided or empty, and so on.<br>
<br>
-- <br>
Maxim Dounin<br>
<a href="http://mdounin.ru/" rel="noreferrer" target="_blank">http://mdounin.ru/</a><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div>
</blockquote></div>