Nginx and conditional logformat

Marcello Lorenzi cello86 at gmail.com
Fri Jul 26 13:49:05 UTC 2019


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.

Marcello

On Thu, Jul 25, 2019 at 3:19 PM Maxim Dounin <mdounin at mdounin.ru> wrote:

> Hello!
>
> On Thu, Jul 25, 2019 at 05:08:30AM -0400, cello86 at gmail.com wrote:
>
> > Hi All,
> > we tried to add some debug information into our access_log for a service
> > with a client certificate authentication. Actually we print some
> information
> > related to the clients but we would print into the logs the client
> > certificate sent by the client during the handshake in case of error. We
> > tried to put the generic logformat into the server block and another
> > logformat into the if condition, but the first wins always versus the
> > second.
> >
> > Is it possible to config the logformat in a conditional statement?
>
> Yes, check the "if=" parameter of the access_log directive.  See
> here for details:
>
> http://nginx.org/r/access_log
>
> --
> Maxim Dounin
> http://mdounin.ru/
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20190726/aa649c6b/attachment.html>


More information about the nginx mailing list