I want to create a script that parses or makes sense of apache\'s error log to see what the most recent error was. I was wondering if anyone out there has something that doe
for anyone else looking for a sample script, i threw something together, it's got the basics:
Date
Type
Client
Message
foreach($output as $line) {
// sample line: [Wed Oct 01 15:07:23 2008] [error] [client 76.246.51.127] PHP 99. Debugger->handleError() /home/gsmcms/public_html/central/cake/libs/debugger.php:0
preg_match('~^\[(.*?)\]~', $line, $date);
if(empty($date[1])) {
continue;
}
preg_match('~\] \[([a-z]*?)\] \[~', $line, $type);
preg_match('~\] \[client ([0-9\.]*)\]~', $line, $client);
preg_match('~\] (.*)$~', $line, $message);
?>
=$date[1]?>
=$type[1]?>
=$client[1]?>
=$message[1]?>
}
?>