Regex for site visits -> logs

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Regex for site visits -> logs

Post by mjseaden »

Hi,

Can anyone tell me of a regex() that will determine the number of unique visitors to a site from standard apache log files?

I appreciate this will likely have to be a regex/PHP combo, but I really need help with the regex(). If anyone can refer me to any relevant material (a straight regex with explanation would be REALLY helpful) I'd be grateful.

Many thanks

Mark
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post by djot »

-
Hi,

As far as I know a regular expression won't help you here.
You may parse each row of the log with that, but for sure not have a complex counter program out of only one regex.

djot
-
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

PLEASE. DON'T. DOUBLE. POST.

viewtopic.php?p=157500&highlight=#157500
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post by mjseaden »

Hi Guys

Apologies for the double post - I accidently post initially to the wrong forum (general discussion).

I think it's a good question on the other thread exactly what is meant by 'unique visits'. Would it be a reasonable definition to say those coming from unique IPs?

Cheers

Mark
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Unique IPs != Unique Visitors :)

Users may share IPs from sharing a similar or same connection. For example networked pcs, and even ISPs. Reminds me of the case where two users had the same IP - we were scanning for multiple accounts on a game server. Both people turned out to be several states apart (US), but used the same ISP.

I agree it's a very rough guide - but it's not exact. There's exceptions to the rule. One of the reasons I only use IP banning in extreme cases...
Post Reply