Welcome! Log In Create A New Profile

Advanced

access log request without query string

Posted by Frank Liu 
Frank Liu
access log request without query string
April 20, 2017 02:10AM
Hi,

What's the best way to login the original request uri ($request_uri)
without query string? I tried $uri but it seems to be normalized and if I
have customized 404 error page /404.html, all those requests are logged as
/404.html instead of original requests uri.

Thanks!
Frank
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Zhang Chao
Re: access log request without query string
April 20, 2017 03:30AM
Maybe lua-nginx-module is more convenient :)


On 20 April 2017 at 08:08:46, Frank Liu ([email protected]) wrote:

Hi,

What's the best way to login the original request uri ($request_uri)
without query string? I tried $uri but it seems to be normalized and if I
have customized 404 error page /404.html, all those requests are logged as
/404.html instead of original requests uri.

Thanks!
Frank
朱_______________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Oleg A. Mamontov
Re: access log request without query string
April 20, 2017 11:30AM
On Wed, Apr 19, 2017 at 09:23:11PM -0400, Zhang Chao wrote:
> Maybe lua-nginx-module is more convenient :)

Please don't overcomplicate such a simple task ;)
The following approach should just work:
--------------------------------
map $request_uri $request_path {
~(?<path>[^?]*) $path;
}
--------------------------------

> On 20 April 2017 at 08:08:46, Frank Liu ([email protected]) wrote:
>
> Hi,
>
> What's the best way to login the original request uri ($request_uri)
> without query string? I tried $uri but it seems to be normalized and if I
> have customized 404 error page /404.html, all those requests are logged as
> /404.html instead of original requests uri.
>
> Thanks!
> Frank

--
Cheers,
Oleg A. Mamontov

mailto: oleg@mamontov.net

skype: lonerr11
cell: +7 (903) 798-1352
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Frank Liu
Re: access log request without query string
April 21, 2017 05:50AM
I was thinking about lua but the map regex is much better.
Thanks!
Frank


On Thu, Apr 20, 2017 at 2:25 AM, Oleg A. Mamontov <[email protected]> wrote:

> On Wed, Apr 19, 2017 at 09:23:11PM -0400, Zhang Chao wrote:
> > Maybe lua-nginx-module is more convenient :)
>
> Please don't overcomplicate such a simple task ;)
> The following approach should just work:
> --------------------------------
> map $request_uri $request_path {
> ~(?<path>[^?]*) $path;
> }
> --------------------------------
>
> > On 20 April 2017 at 08:08:46, Frank Liu ([email protected]) wrote:
> >
> > Hi,
> >
> > What's the best way to login the original request uri ($request_uri)
> > without query string? I tried $uri but it seems to be normalized and if I
> > have customized 404 error page /404.html, all those requests are logged
> as
> > /404.html instead of original requests uri.
> >
> > Thanks!
> > Frank
>
> --
> Cheers,
> Oleg A. Mamontov
>
> mailto: oleg@mamontov.net
>
> skype: lonerr11
> cell: +7 (903) 798-1352
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login