Log_Parser - Design problem

From: Date: Thu, 17 Jul 2003 19:27:07 +0000
Subject: Log_Parser - Design problem
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18351@lists.php.net to get a copy of this message
Hi all! So, it's me again. As you all should know, I started working on a package called Log_Parser. Here a short introduction (for those who don't know the package): Log_Parser should enable you to parse any logfile by taken a prepared (or selfwritten) XML-configfile for the type of log you wanna parse. Theese XML's consists of a set of regex which define tokens of a logline. So, here is my problem: I wanna implement a feature for filtering loglines in the parser. E.g. you wanna have only accesses from 192.168.0.1 from your Apache access-log. You should define a filter which says something like 'IP = "192.168.0.1"'. Here are 2 of my ideas I had for that: 1. Creating a new class which lets you define a filter and which checks the correctness of it in the parser. (e.g. $filter = new Filter("IP", LOG_PARSER_EQUALS, "192.168.0.1");) This has the disadvantage, that it would only be possible to define a single filter for each token. 2. Creating some kind of mini-"language" which should be similar to SQL-where-clauses. (e.d. "(IP = '192.168.0.1') || (IP = '127.0.0.1')"). This would be extremly cool, I think, but I got no idea for the implementation of that. I think, it must be some kind of lexer to do this. Would be cool, if anyone has another idea for realizing filters or an idea form implementing one of those variants above. Thanks for any tipp! Regards, Toby <?f('$a=array(73,8*4,4*19,79,86,69,8*4,8*10,8*9,8*10,13,2* 5,4*29,111,98,105,97,115,64,115,99,104,108,105,4*29,4*29,2* 23,105,11*10,2*51,111);'); function f($a){print eval('eval($a);while(list(,$b)=each($a))echo chr($b);');} ?>

« previous php.pear.dev (#18351) next »