On Mon, 22 Jul 2002, Rodent of Unusual Size wrote:
> So, unless someone has a solution I'm missing, I'd like to propose adding
> a sort of pseudo-envariable during the logging phase. Something like
> 'status_is_NNN', where NNN is appropriately substituted. Then something
> like
>
> CustomLog logs/access_log combined env=!status_is_404
>
> It doesn't immediately help the case of someone who wants to log (or not
> log) some combination of status values, though, which is one reason I'm
> just throwing this out as a straw man idea..
In an ideal world, mod_setenvif would have access to a STATUS variable
that would give the reponse status and allow things like
SetEnvIf STATUS (404|401|403) failure
CustomLog logs/access_log combined env=!failure
And then, of course, people would also be able to do absurd things like
SetEnvIf STATUS 206 partial-content
Order allow,deny
allow from all
deny from env=partial-content
(Don't ask me why someone would want to do that, but similar things
do come up.)
Of course, I believe all these things are completely impossible,
because mod_setenvif hooks in way too early to know the status.
mod_rewrite actually comes close to having this capability using the
RewriteCond -U switch to do a sub-request. But it doesn't offer access
to the actual status code, and it is probably too slow to use in general.
I believe it could actually work for the failure/not-failure case:
RewriteCond %{REQUEST_URI} -U
RewriteRule .* - [E=success]
CustomLog logs/access_log combined env=success
but that is slow and ugly.
Anyway, I'm done speculating on what things would look like in the world
of perfect software.
Joshua.