Php preg_match apache custom logs -


hello have logs example:

x.xx.xxx.xx - username [06/mar/2014:14:22:24 +0400] "get /folder/folder1/file.php http/1.1" 200 246 

i use apache-log-parser.php

standard pattern preg_match log file wrong.

preg_match("/^(\s+) (\s+) (\s+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] \"(\s+) (.*?) (\s+)\" (\s+) (\s+) (\".*?\") (\".*?\")$/", $line, $matches); 

please reg_exp .

just remove last parts:

preg_match("/^(\s+) (\s+) (\s+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] \"(\s+) (.*?) (\s+)\" (\s+) (\s+)$/", $line, $matches); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

angularjs - ng-repeat duplicating items after page reload -