All pastes #190666 Raw Edit

Something

public text v1 · immutable
·published 2006-10-04 06:56 UTC
rendered paste body
    $apache = explode("\n",$this->contents);

    foreach($apache as $record)
      {

        preg_match_all("/^(\S+) (\S+) (\S+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] \"(\S+) (.*?) (\S+)\" (\S+) (\S+) (\".*?\") (\\".*?\")/", $record, $matches);

        $log['ip'] = $matches[1];
        $log['identity'] = $matches[2];
        $log['user'] = $matches[2];
        $log['date'] = $matches[4];
        $log['time'] = $matches[5];
        $log['timezone'] = $matches[6];
        $log['method'] = $matches[7];
        $log['path'] = $matches[8];
        $log['protocal'] = $matches[9];
        $log['status'] = $matches[10];
        $log['bytes'] = $matches[11];
        $log['referer'] = $matches[12];
        $log['agent'] = $matches[13];

      }

    var_dump($log);