Skip to content

Instantly share code, notes, and snippets.

@bobmagicii
Created July 26, 2012 06:47
Show Gist options
  • Save bobmagicii/3180626 to your computer and use it in GitHub Desktop.
Save bobmagicii/3180626 to your computer and use it in GitHub Desktop.
<?php
$file = new SplFileObject('/var/log/apache/access-json.log');
$file->setFlags(SplFileObject::DROP_NEW_LINE);
foreach($file as $line) {
if(!$line) continue;
$log = json_decode($line);
if(!is_object($log)) continue;
print_r($log);
}
unset($file);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment