将Apache访问日志存储到MySQL
我将此引用到mysql数据库的日志访问信息中 下面是我的数据库结构 apachelogs.web\u访问\u日志 当从浏览器收到请求时,我看到大多数列值如下所示为空:将Apache访问日志存储到MySQL,mysql,apache,logging,Mysql,Apache,Logging,我将此引用到mysql数据库的日志访问信息中 下面是我的数据库结构 apachelogs.web\u访问\u日志 当从浏览器收到请求时,我看到大多数列值如下所示为空: +------+-------+------------+-----------+--------+------------+--------------+---------+-------------+----------------+-------------+------------------+--------------
+------+-------+------------+-----------+--------+------------+--------------+---------+-------------+----------------+-------------+------------------+--------------+----------------+------------------+--------------+-------------+--------------+-------------+------------+-------------+----------------+--------+------------+--------------+
| id | agent | bytes_sent | child_pid | cookie | machine_id | request_file | referer | remote_host | remote_logname | remote_user | request_duration | request_line | request_method | request_protocol | request_time | request_uri | request_args | server_port | ssl_cipher | ssl_keysize | ssl_maxkeysize | status | time_stamp | virtual_host |
+------+-------+------------+-----------+--------+------------+--------------+---------+-------------+----------------+-------------+------------------+--------------+----------------+------------------+--------------+-------------+--------------+-------------+------------+-------------+----------------+--------+------------+--------------+
| - | - | 0 | NULL | NULL | NULL | NULL | - | ::1 | NULL | - | 0 | NULL | NULL | HTTP/1.0 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 408 | 1531980584 | 192.168.4.18 |
+------+-------+------------+-----------+--------+------------+--------------+---------+-------------+----------------+-------------+------------------+--------------+----------------+------------------+--------------+-------------+--------------+-------------+------------+-------------+----------------+--------+------------+--------------+
1 row in set (0.02 sec)
缺少大多数请求参数。让我知道我必须修改什么,以便用相应的值记录所有属性
谢谢,由于'id'列宽度不匹配,Apache2无法将日志正确写入MySQL数据库。在
web\u access\u log
表中创建的默认宽度为19,应增加到25。如果25没有帮助,请用更大的宽度再试一次
完成此操作后,MySQL日志会自动开始更新,不会出现任何其他问题
+------+-------+------------+-----------+--------+------------+--------------+---------+-------------+----------------+-------------+------------------+--------------+----------------+------------------+--------------+-------------+--------------+-------------+------------+-------------+----------------+--------+------------+--------------+
| id | agent | bytes_sent | child_pid | cookie | machine_id | request_file | referer | remote_host | remote_logname | remote_user | request_duration | request_line | request_method | request_protocol | request_time | request_uri | request_args | server_port | ssl_cipher | ssl_keysize | ssl_maxkeysize | status | time_stamp | virtual_host |
+------+-------+------------+-----------+--------+------------+--------------+---------+-------------+----------------+-------------+------------------+--------------+----------------+------------------+--------------+-------------+--------------+-------------+------------+-------------+----------------+--------+------------+--------------+
| - | - | 0 | NULL | NULL | NULL | NULL | - | ::1 | NULL | - | 0 | NULL | NULL | HTTP/1.0 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 408 | 1531980584 | 192.168.4.18 |
+------+-------+------------+-----------+--------+------------+--------------+---------+-------------+----------------+-------------+------------------+--------------+----------------+------------------+--------------+-------------+--------------+-------------+------------+-------------+----------------+--------+------------+--------------+
1 row in set (0.02 sec)