一些项目需要你证明使用者是来自MySQL 数据库的,并且需要你玩MySQL表中写入日志文件。
将下列语句放入Apache配置文件,你可以是Apache日志格式更加容易被MySQL阅读:
LogFormat \
"\"%h\",%{%Y%m%d%H%M%S}t,%>s,\"%b\",\"%{Content-Type}o\", \
\"%U\",\"%{Referer}i\",\"%{User-Agent}i\""
为了使日志文件以那种格式放入MySQL,你可以使用下列的语句:
LOAD DATA INFILE '/local/access_log' INTO TABLE tbl_name
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
The named table should be created to have columns that correspond to those that the LogFormatline
writes to the log file.