Hi Everyone.
I've found this REGEX pattern at
https://coderwall.com/p/snn1ag/regex-to-parse-your-default-nginx-access-logs
(?P<ipaddress>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - -
\[(?P<dateandtime>\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2}
(\+|\-)\d{4})\] ((\"(GET|POST) )(?P<url>.+)(http\/1\.1"))
(?P<statuscode>\d{3}) (?P<bytessent>\d+) (["](?P<refferer>(\-)|(.+))["])
(["](?P<useragent>.+)["])
I am missing why it isn't parsing my access log file:
108.170.163.140 - - [11/Sep/2015:09:59:54 -0400] "GET
/prayers-for-today/20 HTTP/1.0" 200 14982 "-" "Mozilla/5.0 (Linux;
Android 5.0.1; GT-I9505 Build/LRX22C) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/44.0.2403.133 Mobile Safari/537.36" "-"
Would someone with a fresh set of eyes have a look for me please?
This is the syntax where I use it:
if (preg_match($pattern, $line, $matches)) {
Thank you.
Ron