[PATCH] Stream: added extra variables for logging

Hinel Balázs gollam6 at gmail.com
Fri Jul 10 16:10:44 UTC 2020


Hi,
The first one (upstream_addr) contains the address and port in one
single variable, but we need to put them separately into the access
log, that's why we need the two variables. The second one
(remote_addr) contains the client's address, which initiated the
connection from outside. The third one also contains the client
address, if I read correctly, and only if we would use the PROXY
protocol (we don't). What we added here are the variables for address
of the upstream, and the address of the internal interface of nginx,
which is used to establish the connection towards the upstream.

Best regards,
Balazs


On Fri, Jul 10, 2020 at 4:03 PM Vladimir Homutov <vl at nginx.com> wrote:
>
> On Thu, Jul 09, 2020 at 04:20:16PM +0200, Balazs Hinel wrote:
> > # HG changeset patch
> > # User Balazs Hinel <balazs.hinel at nokia.com>
> > # Date 1594225255 -7200
> > #      Wed Jul 08 18:20:55 2020 +0200
> > # Node ID ab1359d9762109d1cccb06fbe85e17168b51ebed
> > # Parent  2ab0ecfe5a5f02f7214b02c8a1f9d6c5843d310e
> > Stream: added extra variables for logging.
> >
> > As a result, the local and remote connection details (address and port)
> > used in the upstream connection can be logged.
> >
> > diff -r 2ab0ecfe5a5f -r ab1359d97621 src/stream/ngx_stream.h
> > --- a/src/stream/ngx_stream.h Tue Jul 07 18:56:06 2020 +0300
> > +++ b/src/stream/ngx_stream.h Wed Jul 08 18:20:55 2020 +0200
> > @@ -192,6 +192,14 @@
> >  } ngx_stream_core_srv_conf_t;
> >
>
> Hello and thank you for contribution!
>
> What problem are you trying to solve and why existing variables
>
> http://nginx.org/en/docs/stream/ngx_stream_upstream_module.html#var_upstream_addr
> http://nginx.org/en/docs/stream/ngx_stream_core_module.html#var_remote_addr
> http://nginx.org/en/docs/stream/ngx_stream_realip_module.html#var_realip_remote_addr
>
> are not enough?
>
> Note also that we log connection events in the error log at INFO level in the
> stream module.
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel


More information about the nginx-devel mailing list