[Solved] Access log filtering by status code
Added by krylus over 4 years ago
Hi there,
I would like to setup filter for my accesslog based on the status code, ie. 401 only, as I am not interested in others which flood the log file. Is such filtering possible with conditonal configuration?
Thanks in advance!
Replies (1)
RE: Access log filtering by status code - Added by gstrauss over 4 years ago
If using access logs, send your access logs to a piped logger. Please see mod_accesslog docs.
If using error logs, parse the auth errors in your error logs. fail2ban has samples for use with lighttpd. http://www.fail2ban.org/wiki/index.php/HOWTOs
Note that lighttpd does not send all 401 errors to the error log. If an Authorization header is not provided, that is a 401 because no authorization information was provided. However, for most people, logging such to the error log would add lots of noise since an initial request without Authorization is a typically part of the client browser discovering that authorization is required.