Nginx and conditional logformat

Maxim Dounin mdounin at mdounin.ru
Mon Jul 29 13:02:20 UTC 2019


Hello!

On Fri, Jul 26, 2019 at 03:49:05PM +0200, Marcello Lorenzi wrote:

> Hi Maxim,
> I tried to configure the location with this example:
> 
> server  {
>         access_log  logs/access_log sslclient;
> 
>         location / {
> 
>             if ($ssl_client_verify != "SUCCESS") {
>                 set $loggingcert 1;
>             }
> 
>             access_log  logs/access_log sslclientfull if=$loggingcert;
> 
>         }
> 
> }
> 
> I noticed that all the request inherit the first access_log configuration
> and not the conditional.

In the configuration in question, all requests handled in 
"location /" will either use the "sslclientfull" log format, or 
won't be logged at all.

If this is not what you observe, most likely you've missed 
something an requests are either not handled in the server in 
question, or not handled in "location /".  For example, this 
may happen if you are using "ssl_verify_client on;" and all 
requests without proper client certificates are terminated with 
error 400 in the server context before any processing, hence they 
are not handled in "location /".

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list