Forum Moderators: phranque

Message Too Old, No Replies

Conditional Logging question

         

spike2000

5:56 am on Oct 13, 2008 (gmt 0)

10+ Year Member



Hi, I'm trying to configure my Apache logging so that it only records requests for specific pages and then splits the log file depending on one of two specific header fields.

Through a fair amount of reading and a very steep learning curve, I'm just abou there.

SetEnvIf Request_URI "^/vtour.jsp" Tour
SetEnvIf Request_URI "^/ptour.jsp" Tour
SetEnvIf Request_URI "^/index.jsp" Tour
SetEnvIf Request_URI "^/freeImg.jsp" Tour
SetEnvIf Request_URI "^/freeVid.jsp" Tour
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{X-MSISDN}i\"" mtn_visitors
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{x-up-calling-line-id}i\"" voda_visitors
CustomLog "¦/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/mtnlogfile 86400" mtn_visitors env=Tour
CustomLog "¦/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/vodalogfile 86400" voda_visitors env=Tour

The above config works for the most part, however each of the two log files also contains entries for the other. For example, the voda_visitors log file also contains all entries logged in mtn_visitors, although without the x-msisdn value.

I would like only the relevant entries logged in each file. I'd appreciate some guidance and also a heads up if there is an easier way to do this.

Cheers