Welcome! Log In Create A New Profile

Advanced

Re: http_log_module filter by status

Maxim Dounin
June 12, 2012 04:10PM
Hello!

On Sun, Jun 10, 2012 at 01:40:12PM -0400, karlseguin wrote:

> I was interested in having nginx log 404s to their own file.
> Essentially, i _hate_ 404s, so I like to parse access logs find and
> report all 404s. However, as-is, parsing large access logs can be quite
> inefficient since 404s represent such a small % of the entire file. I
> was thinking nginx could filter it out at write-time:
>
> access_log not_found.log combined buffer=16K 404;
>
>
> Apologies for the lameness of the code, but this is what I came up
> with:
> https://gist.github.com/2906701
>
> I certainly don't recommend anyone uses it, I'm mostly just looking for
> feedback. Is this better off in its own module? (there's so much code in
> the http_log_module that I want to leverage though). There's much more
> filtering that could go on that perhaps a new directive is a better
> approach:
>
> access_log_filter $status /(40\d)/
> access_log_filter $method GET
>
> (which is certainly beyond my capabilities).
>
> Thoughts?

error_page 404 /404.html;

location = /404.html {
access_log /path/to/log;
}

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

http_log_module filter by status

karlseguin June 10, 2012 01:40PM

Re: http_log_module filter by status

Maxim Dounin June 12, 2012 04:10PM

Re: http_log_module filter by status

B.R. June 12, 2012 06:10PM

Re: http_log_module filter by status

karlseguin June 12, 2012 08:34PM

Re: http_log_module filter by status

Maxim Dounin June 13, 2012 03:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 192
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready