httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [PATCH] Multiple env test for CustomLog directives in 1.3.26 (mod_log-config.c)
Date Sat, 10 Aug 2002 01:07:22 GMT
Alan Skea wrote:

> I don't think SetEnvIf quite does it.  In one module I extract a session tracking token
from the URI and set it into an env var.  If this var is present then I want to use a particular
log format.  I also started looking at a module called robotcop the other day.  It monitors
accesses to the robots.txt file to determine if a request comes from a robot.  Without getting
into the merit or demerits of a stateful module I was trying out logging the robot requests
to a completely different logfile.  In addition there are a number of states that robotcop
can be in that might also affect how (or if) I would want to log the request.
> So the upshot is that I have two modules that set env variables and at least four different
behaviours depending on the values of those variables.  Here's what I want to achieve using
the syntax I proposed:
>         CustomLog logs/robotlog session_fmt env=SESSION,ROBOTCOP
>         CustomLog logs/userlog session_fmt env=SESSION,!ROBOTCOP
>         CustomLog logs/robotlog combined env=!SESSION,ROBOTCOP
>         CustomLog logs/userlog combined env=!SESSION,!ROBOTCOP

SetEnvIf SESSION .+ robot_session
SetEnvIf ROBOTCOP "" !robot_session
SetEnvIf SESSION .+ user_session
SetEnvIf ROBOTCOP .+ !user_session
CustomLog logs/robotlog session_fmt env=robot_session
CustomLog logs/userlog session_fmt env=user_session

That might not be exactly it, but it should be close.

Now, the one thing that might cause problems is if the other modules set 
the variables too late for mod_setenvif to act on.  That would be 
another great use for the LogVariable directive that Ken and I were 
discussing a week or so ago.


View raw message