[CLUE-Tech] Web Statistics Programs
David Anselmi
anselmi at anselmi.us
Wed Mar 17 21:26:44 MST 2004
Jed S. Baer wrote:
> On Tue, 16 Mar 2004 18:11:44 -0700
> David Anselmi <anselmi at anselmi.us> wrote:
>
>>>Speaking of hacking up Apache logs, does anyone know of a way to tell
>>>Perl to split a string, but consider /regex/ characters as quoting
>>>characters?
[...]
>
> Hey, just look at an Apache access log. OK ... it's like this.
>
> token token [multi-part token] token "quoted token" token
Um, I've never seen anyone use split (or anything like it) for that.
Looks like you want more like:
($ip, $date, $request) = \
$log_entry =~ /([0-9.]*) - - \[([^\]]*)\] "([^"]*)"/
so you're using a regex to match the lines and capturing the parts you
want. But looking at production code will get you further than asking
me, I think.
Maybe I've made enough of a mess to prompt a perl guru to speak up ;-)
Dave
More information about the clue-tech
mailing list