Skip to content

Instantly share code, notes, and snippets.

@haruta
Created May 15, 2012 07:58
Show Gist options
  • Save haruta/2699870 to your computer and use it in GitHub Desktop.
Save haruta/2699870 to your computer and use it in GitHub Desktop.
apache combined access log parse by php
preg_match('/^([^ ]*) ([^ ]*) ([^ ]*) \[([^]]*)\] "([^ ]*)(?: *([^ ]*) *([^ ]*))?" ([^ ]*) ([^ ]*) "(.*?)" "(.*?)"/', $buf, $log_stat);
list($all, $host, $ident, $user, $time, $method, $resource, $proto, $status, $bytes, $referer, $agent) = $log_stat;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment