httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
Subject Re: [users@httpd] How to use logical operators in conditional log?
Date Sun, 22 Sep 2002 04:02:02 GMT
Apisilp Trunganont wrote:

> 
> *.gif and *.jpg on /test1/ must be logged to access_log1_img
> other extensions on /test1/ must be logged to access_log1
> *.gif and *.jpg on /test2/ must be logged to access_log2_img
> other extensions on /test2/ must be logged to access_log2
> *.gif and *.jpg on other directories must be logged to access_log_img
> other extensions on other directories must be logged to access_log

In general, this is a bad idea; just use a decent log post-processor to 
get what you want.

But if you insist, here's something to get you started.  I'm sure it is 
not the best way to do it, but it should work.  (I only dealt with 
/test1/.  It should be obvious how to add test2.)

SetEnvIf Request_URI ".*" img=0
SetEnvIf Request_URI "^/test1/" test1=1
SetEnvIf Request_URI "\.(gif|jpg)$" img=1

SetEnvIf test1 1 access_log1
SetEnvIf img 1 !access_log1
CustomLog /log/access_log1 combined env=access_log1

SetEnvIf test1 1 access_log1_img
SetEnvIf img 0 !access_log1_img
CustomLog /log/access_log1 combined env=access_log1

SetEnvIf Request_URI .* access_log_img
SetEnvIf img 0 !access_log_img
SetEnvIf test1 !access_log_img
CustomLog /log/access_log_img combined env=access_log_img

SetEnvIf Request_URI .* access_log
SetEnvIf test1 1 !access_log
SetEnvIf img 1 !access_log
CustomLog /log/access_log combined env=access_log

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message