一個統計資料的有關問題 求指點

來源:互聯網
上載者:User
一個統計資料的問題 求指點
113.64.79.0 - - [04/Jul/2012:10:03:41 +0800] "GET /upfile/201207/201207040939177110.jpg HTTP/1.1" 200 18315 "http://www.liketry.com/paytry.php" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2; 360SE)" -
27.115.127.146 - - [04/Jul/2012:10:03:41 +0800] "GET /images/default/fufei.png HTTP/1.1" 304 0 "http://www.liketry.com/index.php" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0(Compatible Mozilla/4.0(Compatible-EmbeddedWB 14.59 http://bsalsa.com/ EmbeddedWB- 14.59 from: http://bsalsa.com/ ; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; Maxthon 2.0)" -
116.21.255.71 - - [04/Jul/2012:10:03:41 +0800] "GET /images/ui-bg_glass_100_f6f6f6_1x400.png HTTP/1.1" 200 1009 "http://www.liketry.com/user_login.php?returnurl=http%3A%2F%2Fwww.liketry.com%2Fget_password.php%3Fmail%3D512695867%40qq.com%26&rr=0&loginUname=512695867@qq.com&error=5a+G56CB6ZSZ6K+v" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; .NET CLR 2.0.50727; 360SE)" -


類似這種記錄 一個 有 一萬條
我取了三條
我需要 從這些資料中 的到 做例子 字串中 "http: xxxx" 前面的 那個流量資料
求方法


------解決方案--------------------
PHP code
// 這個實現有多種方法,現在列出其中的一種preg_match_all('/\"GET[ ]*\/upfile[^ ]+[ ]+HTTP\/1\.1\"[ ]+\w+[ ]+(\d+)[ ]+\"/', $s, $a1);preg_match_all('/\"GET[ ]*\/(?!upfile)[^ ]+[ ]+HTTP\/1\.1\"[ ]+(\d+)[ ]+(\d+)[ ]+\"/', $s, $a2);//p($a1);p($a2);
------解決方案--------------------
日誌是一行一行的, 這種統計太基礎了, awk/cut/php按空白分割取第N段就行了。
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.