下边这个样子的日志PHP解析正则咋写?Oct 23 09:46:28 SMS-1 postfix/smtpd[8733]: connect from unknown[192.168.90.6]
Oct 23 09:46:28 SMS-1 postfix/smtpd[8733]: 18FDC3BA695: client=unknown[192.168.90.6], sasl_method=LOGIN, [email protected]
Oct 23 09:46:28 SMS-1 postfix/cleanup[8736]: 18FDC3BA695: message-id=<[email protected]>
Oct 23 09:46:28 SMS-1 postfix/smtpd[8733]: disconnect from unknown[192.168.90.6]
Oct 23 09:46:28 SMS-1 postfix/qmgr[8129]: 18FDC3BA695: from=<[email protected]>, size=10839, nrcpt=1 (queue active)
Oct 23 09:46:28 SMS-1 postfix/smtp[9043]: 18FDC3BA695: to=<[email protected]>, relay=mailcenter.quanshi.com[203.174.100.15]:25, delay=0.12, delays=0.01/0/0.06/0.05, dsn=2.0.0, status=sent (250 2.0.0 q9N1mTgc026815 Message accepted for delivery)
Oct 23 09:46:28 SMS-1 postfix/qmgr[8129]: 18FDC3BA695: removed
Oct 23 09:46:28 SMS-1 postfix/smtpd[8733]: 18FDC3BA695: client=unknown[192.168.90.6], sasl_method=LOGIN, [email protected]
Oct 23 09:46:28 SMS-1 postfix/cleanup[8736]: 18FDC3BA695: message-id=<[email protected]>
Oct 23 09:46:28 SMS-1 postfix/smtpd[8733]: disconnect from unknown[192.168.90.6]
Oct 23 09:46:28 SMS-1 postfix/qmgr[8129]: 18FDC3BA695: from=<[email protected]>, size=10839, nrcpt=1 (queue active)
Oct 23 09:46:28 SMS-1 postfix/smtp[9043]: 18FDC3BA695: to=<[email protected]>, relay=mailcenter.quanshi.com[203.174.100.15]:25, delay=0.12, delays=0.01/0/0.06/0.05, dsn=2.0.0, status=sent (250 2.0.0 q9N1mTgc026815 Message accepted for delivery)
Oct 23 09:46:28 SMS-1 postfix/qmgr[8129]: 18FDC3BA695: removed
解决方案 »
- 我用jquery的AJAX通过POST过来数据 appliction/json-rpc 接收不到,这是为什么??
- php不能正常运行是怎么回事
- 腾讯php程序员面试题目,大家来讨论下~
- 求一条查询语句?
- 类似于google 土豆的搜索框 我的做法是onkeydown显示下拉框 失去焦点时隐藏 但是点下拉框里的内容的时候焦点也没了 这是也隐藏了 怎么办?
- PostgreSQL下limit查询的问题。急!
- 大家能帮我找一个用MSSQL数据库实现的计数器吗。
- windows系统如何支持gd库?
- mail()不能发信的原因...
- 帮我看看用什么函数可以实行下面的结果
- 新手问题--多关键词如何描红。
- php fastcgi问题,死锁,超时
$file = fopen("zmxc.access_20120516.log","r");
set_time_limit(0);
$link = mysql_connect(*) or die('222');//自己的数据库信息
mysql_select_db('test',$link) or die('111');
mysql_query ('set names utf8');
$i =0;
while($count = fgets($file)){
$array = explode(' HTTP/1.1 ',$count);
$string = $array[0];
$que=substr($array[1],0,3);
if($que == '200'){
$i++ ;
$arr = explode(' +0800] ',$string);
$ips = explode(' - - [',$arr[0]);
$t2 =substr(strstr($ips[1],':'),1);
$t1 = explode(':',$ips[1]);
$times = $t1[0].' '.$t2;
$time=strtotime(strtr($times,'/',' '));
$ip = $ips[0];
$src = $arr[1];
if(strstr($src,'&id=')){
$ids = explode('&id=',$src);
$id =$ids[1];
}
mysql_query("INSERT INTO `logs_16` (`t_id`,`src`,`ip`,`intip`,`time`) VALUES ('$id','$src','$ip', inet_aton('$ip'),'$time')");
unset($id);
}
}
echo $i;
fclose($fp);
?>