I patched mod_log_config.c (from the 2.0.51 distro) to allow
conditional logging on HTTP status code, like so:
CustomLog king-size.log common status=414
The patch also supports "not" and lists (like the %.. syntax) and
"wildcards", e.g.:
CustomLog ungood.log common status=!20x,3xx
The changes are non-intrusive and the patch is of course backward
compatible.
Rationale: Like everybody else, my servers are increasingly getting
hit with overly long requests. Apache fends them off with a 414, but
those critters are a nuisance in the logs. Sticking "%414r" in the log
format takes care of that, but it also means the request data is lost. I
want to know what's brewing out there so I wanted these request in a
separate log.
It works fine for me and I'd leave it at that, but Googling around
reveals that this might be useful to others.
I already patched the docs and am willing to go the extra mile(s) to
make it all "nice", but the "guidelines for contributing a patch" say
you're a conservative lot when it comes to new functionality.
So, pray tell how I can convince you this is the best thing since
sliced bread ;-)
For a start I'd like to invite comments on a) the concept and b) the
syntax.
If these are acceptable, I would prepare and submit the patch itself
so you can judge the code.
One more thing: I became aware that the "flexible interface for
mod_log_config" patch (# 25014) also allows conditioning on status
code(s), and there are three other contributed patches against
mod_log_config waiting for a decision (# 28037, 29449 and 31311). I am
willing to ensure compatibility with any or all of them if desired.
Thanks for your time,
Luc Pardon
Skopos Consulting
Belgium