You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jim Sproull <ji...@sitepak.com> on 2000/06/15 15:32:48 UTC

PerlLogHandler and mod_usertrack

 Hi all,

  I'm looking to using mod_usertrack to log requests based on cookies (which
it's good at, of course).  I have this all in and working fine.  However,
I'm using my own PerlLogHandler to handle all the logging.  mod_usertrack
allows a CustomLog variable called %{cookie}n which contains the current
session id, called like:

CustomLog logs/clickstream "%{cookie}n %r %t"

(from http://www.apache.org/docs/mod/mod_usertrack.html)

 But, since I'm using my own LogHandler, I need to somehow get access to
this variable directly.  Has anyone used these two together before, or can
point me in the right direction?  Or do I have to do some source hacking?
Thanks!

Jim Sproull
jim@sitepak.com


RE: PerlLogHandler and mod_usertrack

Posted by Jim Sproull <ji...@sitepak.com>.

> -----Original Message-----
> From: Jacob Davies [mailto:jacob@sfinteractive.com]
> Sent: Thursday, June 15, 2000 1:46 PM
> To: Ian Kallen
> Cc: Jim Sproull; modperl@apache.org
> Subject: Re: PerlLogHandler and mod_usertrack
>
>

 Hi Guys!

> On Thu, Jun 15, 2000 at 10:23:38AM -0700, Ian Kallen wrote:
> > Hi Jacob!
>
> Hi Ian!
>
>
> That also changes the mechanism from log-on-set to log-on-return, though.
> If they didn't have a cookie, on their first request mod_usertrack will
> set it and log it.  If you only log from inbound cookies, though, you
> don't log on that first request.
>
> You'll lose external Referer data from that first request, which
> may or may
> not matter to you.  On the bright side, when someone with cookies switched
> off goes through your site, they won't leave a trail of orphan
> cookies with
> them (cookies set and logged, but never returned).
>

  I guess this is a trade-off I'll have to weigh.  I need the Referer data
from the first request, but also don't want all those extra unused cookies
being logged.  I guess I'll have to do some post-processing with the logs.
Anyway,  thanks for the tips!

Jim
jim@sitepak.com


Re: PerlLogHandler and mod_usertrack

Posted by Jacob Davies <ja...@sfinteractive.com>.
On Thu, Jun 15, 2000 at 10:23:38AM -0700, Ian Kallen wrote:
> Hi Jacob!

Hi Ian!

> Difference being that if you change your cookie'ing to use something other
> than mod_usertrack, you'll have to make sure it also creates that key for
> it in the notes table otherwise your PerlLogHandler won't see it. 

True.  But it's quite a nice convention to follow.

> $r->header_in('Cookie') should always be there for slicing and dicing...
> I'm probably splitting hairs here but I like to be flexible.

That also changes the mechanism from log-on-set to log-on-return, though.
If they didn't have a cookie, on their first request mod_usertrack will
set it and log it.  If you only log from inbound cookies, though, you
don't log on that first request.

You'll lose external Referer data from that first request, which may or may
not matter to you.  On the bright side, when someone with cookies switched
off goes through your site, they won't leave a trail of orphan cookies with
them (cookies set and logged, but never returned).

> Today, Jacob Davies <ja...@sfinteractive.com> frothed and gesticulated...:
> > The %{cookie}n refers to the cookie field of the notes table, so you should
> > be able to get at it directly from Perl with:
> > 	$r->notes( 'cookie' );

-- 
Jacob Davies
Lead UNIX Engineer
SF Interactive
jacob@sfinteractive.com

Re: PerlLogHandler and mod_usertrack

Posted by Ian Kallen <sp...@salon.com>.
Hi Jacob!
Difference being that if you change your cookie'ing to use something other
than mod_usertrack, you'll have to make sure it also creates that key for
it in the notes table otherwise your PerlLogHandler won't see it. 
$r->header_in('Cookie') should always be there for slicing and dicing...
I'm probably splitting hairs here but I like to be flexible.
-Ian

Today, Jacob Davies <ja...@sfinteractive.com> frothed and gesticulated...:
> The %{cookie}n refers to the cookie field of the notes table, so you should
> be able to get at it directly from Perl with:
> 
> 	$r->notes( 'cookie' );
> 
> On Thu, Jun 15, 2000 at 10:12:40AM -0700, Ian Kallen wrote:
> > If you're writing your own PerlLogHandler, get the cookie from the request
> > object, $r->header_in('Cookie')
> > -Ian
> 
> 

--
Salon Internet 				http://www.salon.com/
  Manager, Software and Systems "Livin' La Vida Unix!"
Ian Kallen <id...@salon.com> / AIM: iankallen / Fax: (415) 354-3326 


Re: PerlLogHandler and mod_usertrack

Posted by Jacob Davies <ja...@sfinteractive.com>.
The %{cookie}n refers to the cookie field of the notes table, so you should
be able to get at it directly from Perl with:

	$r->notes( 'cookie' );

On Thu, Jun 15, 2000 at 10:12:40AM -0700, Ian Kallen wrote:
> If you're writing your own PerlLogHandler, get the cookie from the request
> object, $r->header_in('Cookie')
> -Ian

-- 
Jacob Davies
Lead UNIX Engineer
SF Interactive
jacob@sfinteractive.com

Re: PerlLogHandler and mod_usertrack

Posted by Ask Bjoern Hansen <as...@valueclick.com>.
On Thu, 15 Jun 2000, Jim Sproull wrote:

>   I'm looking to using mod_usertrack to log requests based on cookies (which
> it's good at, of course).  I have this all in and working fine.  However,
> I'm using my own PerlLogHandler to handle all the logging.  mod_usertrack
> allows a CustomLog variable called %{cookie}n which contains the current
> session id, called like:
[...] 
>  But, since I'm using my own LogHandler, I need to somehow get access to
> this variable directly. 

$r->notes('cookie');

see the mod_usertrack source.

You can also take the Apache::Usertrack module and tweak it to do what you
need.

 - ask

-- 
ask bjoern hansen - <http://www.netcetera.dk/~ask/>
more than 70M impressions per day, <http://valueclick.com>


Re: PerlLogHandler and mod_usertrack

Posted by Ian Kallen <sp...@salon.com>.
If you're writing your own PerlLogHandler, get the cookie from the request
object, $r->header_in('Cookie')
-Ian

Today, Jim Sproull <ji...@sitepak.com> frothed and gesticulated about...:
>   I'm looking to using mod_usertrack to log requests based on cookies (which
> it's good at, of course).  I have this all in and working fine.  However,
> I'm using my own PerlLogHandler to handle all the logging.  mod_usertrack
> allows a CustomLog variable called %{cookie}n which contains the current
> session id, called like:
> 
> CustomLog logs/clickstream "%{cookie}n %r %t"
> 
> (from http://www.apache.org/docs/mod/mod_usertrack.html)
> 
>  But, since I'm using my own LogHandler, I need to somehow get access to
> this variable directly.  Has anyone used these two together before, or can
> point me in the right direction?  Or do I have to do some source hacking?
> Thanks!

--
Salon Internet 				http://www.salon.com/
  Manager, Software and Systems "Livin' La Vida Unix!"
Ian Kallen <id...@salon.com> / AIM: iankallen / Fax: (415) 354-3326