[英]Apache Access Log into Regular expression
嗨,有人在這里可以幫助我將apache access_log轉換成像這樣的正則表達式格式嗎?
/^\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*$/
這是我的訪問日志
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
提前致謝!
如有必要,我會嘗試這種做法。
^([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*(.*)$
查看演示: http : //regex101.com/r/aX1uR1/1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.