简体   繁体   中英

Apache Access Log into Regular expression

Hi is there someone here who can help me to convert the this apache access_log into regex format like this one?

/^\w\w\w \d\d? \d\d:\d\d:\d\d\s(\S+)\s(\S+)\s(\d+\.\d+\.\d+\.\d+)\s-\s-\s\[([^\[]+)\] "(\S+) (.*?) (\S+)\/\S+" (\d+) (\d+) "(.*?)" "(.*?)"\s*$/

Here is my access log

2014-10-24 00:00:00 W3SVC1 DK-PV-Proxy 192.168.200.201 GET /news_details.aspx news_id=58096&X-ARR-CACHE-HIT=0&X-ARR-LOG-ID=410f1d3b-e790-4b07-8c68-561d0f5fc9e4 80 - 66.249.69.186 HTTP/1.1 Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) - - www.alkass.net 200 0 0 36957 309 613

Thanks in advance!

I try this take if necessary.

^([0-9-]+)\s*([0-9]+\:[0-9]+\:[0-9]+)\s*([a-zA-Z0-9\-\s]*)([0-9]{3}\.[0-9]{3}\.[0-9]{3}\.[0-9]{3})\s*(.*)$

SEE DEMO: http://regex101.com/r/aX1uR1/1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM