1. 程式人生 > >apache訪問日誌access.log的解析以及如何將其匯入mysql

apache訪問日誌access.log的解析以及如何將其匯入mysql

mysql> select * from apache_log limit 3;
+----+-----------------+---------+--------------+-----------------------+-----------+--------+--------------------------------------------+----------+--------+-------+-------+------------------------------------------------------------------------------------+
| id | hostip | marking | browser_name | addtime | time_zone | method | resource | protocol | status | bytes | refer | client_info |
+----+-----------------+---------+--------------+-----------------------+-----------+--------+--------------------------------------------+----------+--------+-------+-------+------------------------------------------------------------------------------------+
| 1 | 220.181.108.116 | - | - | [21/Aug/2013:23:59:59 | +0800] | "GET | /search/prj/tag/2089-2124-2350-2354-1.html | HTTP/1.1 | 200 | 8181 | "-" | "Mozilla/5.0(compatible;Baiduspider/2.0;+http://www.baidu.com/search/spider.html)" |
| 2 | 220.181.165.5 | - | - | [21/Aug/2013:23:59:59 | +0800] | "GET | /event/bushanping/admin_login.php | HTTP/1.1 | 200 | 32095 | "-" | "Mozilla/5.0(Windows;U;WindowsNT5.1;zh-CN;rv:1.9.1.1)Gecko/20090715Firefox/3.5.1" |
| 3 | 220.181.165.136 | - | - | [21/Aug/2013:23:59:59 | +0800] | "GET | /search/diy/server-status/ | HTTP/1.1 | 404 | 21795 | "-" | "Mozilla/5.0(Windows;U;WindowsNT5.1;zh-CN;rv:1.9.1.1)Gecko/20090715Firefox/3.5.1" |
+----+-----------------+---------+--------------+-----------------------+-----------+--------+--------------------------------------------+----------+--------+-------+-------+------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

匯入成功