2013-06-23 04:33:51 W3SVC1539885 198.56.185.162 GET /robots.txt - 80 - 66.249.75.65 Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) 404 0 2
我想分别匹配日期2013-06-23/时间04:33:51/服务器ip198.56.185.162/文件地址robots.txt/蜘蛛ip66.249.75.65/蜘蛛信息Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html)/状态码404 0 2/,这个如何精确匹配?
我想分别匹配日期2013-06-23/时间04:33:51/服务器ip198.56.185.162/文件地址robots.txt/蜘蛛ip66.249.75.65/蜘蛛信息Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html)/状态码404 0 2/,这个如何精确匹配?
$log = '2013-06-23 04:33:51 W3SVC1539885 198.56.185.162 GET /robots.txt - 80 - 66.249.75.65 Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) 404 0 2';
var_dump( explode(' ', $log) );
/**
array(14) {
[0]=>
string(10) "2013-06-23"
[1]=>
string(8) "04:33:51"
[2]=>
string(12) "W3SVC1539885"
[3]=>
string(14) "198.56.185.162"
[4]=>
string(3) "GET"
[5]=>
string(11) "/robots.txt"
[6]=>
string(1) "-"
[7]=>
string(2) "80"
[8]=>
string(1) "-"
[9]=>
string(12) "66.249.75.65"
[10]=>
string(72) "Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html)"
[11]=>
string(3) "404"
[12]=>
string(1) "0"
[13]=>
string(1) "2"
}
*/