Piper

-= Intro =-

	I wanted something more than logging to flat files, as that isn't (I think) the best of ways do actually analyse logs and stuff.
	I also wanted "real time" data access as a way to avoid using tail all the time :)
	SO I THOUGHT ... Apache can PIPE log data to a process, PHP reads from stdin, PHP talks to databases ... hummmm, maybe I could try something?
	I did, and I worked ... on a basic level it does what it is asked to do ....
	Like I said, It's working, not perfectly, but enought that I can share and ask for people to try it out on their systems
	
-= Stuff to setup =-

Apache - httpd.conf

	1	The first line formats the log as we wanted (ok, I), my choice for this weird XML stuff has to be with ease of parsing (xml parser and CDATA means I can handle the fields better than plain CSV ou something like that)
		Anyway, there's probably more data here than usually needed BUT that's life :)

LogFormat "<logEntry><remoteIP>%a</remoteIP><localIP>%A</localIP><bytesSentNoHeaders>%B</bytesSentNoHeaders><timeTaken>%D</timeTaken><fileName><![CDATA[%f]]></fileName><remoteHost>%h</remoteHost><requestProtocol>%H</requestProtocol><requestMethod>%m</requestMethod><serverPort>%p</serverPort><processID>%P</processID><threadID>%{tid}P</threadID><queryString><![CDATA[%q]]></queryString><firstLineRequest><![CDATA[%r]]></firstLineRequest><status>%s</status><timestamp>%{%Y-%m-%d %H:%M:%S}t</timestamp><urlPath>%U</urlPath><serverName>%v</serverName><connectionStatus>%X</connectionStatus><referer><![CDATA[%{Referer}i]]></referer></logEntry>" fullXML

	2  PIPE Magic, in other words, this is the part we tell Apache to please please please send fullXML log to a process .. our process :)
		I'm using windows, and for now I'm having to pipe stuff to the php parser who executes the php script ... you might be able to pipe things
		directly to the script ... 
		
CustomLog "|c:/progra~1/servers/php/php.exe -q c:/php_root/projectos/xmlLogger/scripts/xmlLog.php" fullXML

xmlLog.php

$lConfig['Debug'] 		= true/false
$lConfig['errFilePath'] = <pathToErrorLogFile>, this means it's your choice
$lConfig['pidFilePath'] = <pathToApachePIDFile>, it's probably on apache/logs ... but check it out, there is a reason for this ... I guess
$lConfig['dbAddress']   = <IP Address of the host>
$lConfig['dbUser']      = <database Username>
$lConfig['dbPassword'] 	= <database username password>
$lConfig['dbSchema']   	= <name the thing>

Beyond this ... I guess things should somehow work ... if not, SCREAM AT ME @ dramalho (at) blackorange (dot) pt
