in reply to Re: Perl readable Weblogs
in thread Perl readable Weblogs

Ouch! Never thought of the eval issues (though I suppose Safe would help). Unfortunately, having the know the field names before hand goes against the intent. HOWEVER, the following should work well: LogFormat "bytes|%b|filename|%f|remotehost|%h|remoteip|%a|remoteuser|%l|serverport|%p|pid|%P|request|%r|status|%s|time|%t|timeserve|%T|authuser|%u|url|%U|virtual|%v" log_perl then parsing it with a
while (<LOGFILE>) { my %hash=split /\|/,$_; ## do something with %hash ala $hash{time} or $hash{bytes} }
should eliminate the nasty stuff.

Replies are listed 'Best First'.
Re: Re: Re: Perl readable Weblogs
by knobunc (Pilgrim) on Apr 20, 2001 at 00:18 UTC

    Hum, you still get hit with the escaping problem since you don't know how many |s to split so you have to pick something that is not going to be in the URL. I would put the url at the end anway, so if they got some odd characters into the log Your new approach is certainly safer since you won't get bitten by evaled code.

    As an aside, someone else noted that you couldn't remove /etc/passwd as nobody, but remember this is a log analysis tool that will be run by some user periodically.

    -ben