On Wed, 13 Feb 2002, Ryan Parr wrote:

> I checked it out and it's a good mod. I've already got the ability to log
> the data however. The issue that I'm having is that I can't seem to only get
> 1 log per hit. I can't seem to get around the fact that wherever I put my
> mod (PerlFixupHandler,PerlHandler,PerlLogHandler) or whatever statement I
> use ($r->is_main(), $r->is_initial_req()) I'm getting not only the requested
> page but every other request from the inital request. For instance, I'm
> getting and logging every graphic, css, javascript, or any other file that's
> linked in. But for my user tracking I want *just* the initial request, not
> that and all subrequests. I just can't seem to figure out how to do that.
> $r->is_main() and $r->is_initial_req() return true for everything.

Maybe i'm wrong, but is_initial_req, is just there, to keep track of
INTERNAL redirects, like, if you internaly redirect a file to another one,
and you don't want to process the redirected one (because you don't care
anymore).

I think the best one for you problem should be something like this...

1.) use a shared hash (IPC::SharedCache or something like this)
2.) compute a MD5-Hash, with some data from the user, like IP and
Browser-string
3.) put the MD5, or whatever in the hash, and set a timeoutvalue for this
one
4.) on every request, lookup for the key, and check/update the
timeout-value, and log the request, if it doesn't exists inside of the
hash, or the timeout occured
5.) run a cleanup every 50/100 request, and clear the cache from timeouted
values (for shared memory, this could also be done by a script running
from crontab)


i hope you get what i mean, and i hope it helps ;)))


ciao nico


Reply via email to