[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] getting requested site from access logs



> Well, I've got a site that receives requests for multiple domains.  I've
> modified the apache log file so that the rewriting of the domain is not
> done.  Therefore if the name of the site is site1.com but you get to it
> by typing site2.com, your browser will continue to show site2.com in the
> URL.
> 
> I'd like to accurately track how many people come to site1 vs. site2.
> However this information is not stored in the log files by default.  For
> example:
> www.site1.com 127.0.0.1 - - [10/May/2002:16:40:47 -0400] "GET
> /Image2.jpg HTTP/1.1" 200 6116 "http://www.site1.com/index.htm";
> "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)"
> 
> Appears regardless of the domain (site1.com or site2.com) that was
> requested.  Combined Log format is by default:
> "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
> 
> However, if I instead use:
> "%{HOST}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
> ( notice the first string, %v changed to %{HOST}i )
> 
> Then the domain that was actually requested shows up in the log file.
> 
> Now, I know that the cobalt server is a delicate balance and tweaking
> things can cause undesirable performance.  I often find undesirable
> performance... well, undesirable.  Therefore I want to avoid it.
> 
> What kind of an impact would you predict this would have?  The first
> thing that comes to my mind is the divvying up of log files that occurs
> in the evening.  I would guess it's for this very reason that the
> rewrite rules are on by default.  My guess is that the utility that
> cobalt uses will discard requests for pages it can't associate with a
> site.

I'm not sure if it has any impact, but just to be safe, couldn't you use the
TransferLog option. If you did, wouldn't that bypass the Cobalt method of
writing to one big access log and splitting it up later? I'm assuming it
would write to the logfile you specify, therefore eliminating the chance of
the Cobalt Sauce mucking around with your logs.

-jay