How to MySQL with Apache?
By inserting the following in the configuration file of <a href="http://www.bodhost.com/ " target="_blank" title=" Apache" style="color:#000000;text-decoration:none;">Apache </a>, MySQl can easily read the logs -
LogFormat \
"\"%h\",%{%Y%m%d%H%M%S}t,%>s,\"%b\",\"%{Conten t-Type}o\", \
\"%U\",\"%{Referer}i\",\"%{User-Agent}i\""
In order to load the log file in the logging format into MySQL, you can process the following -
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 which correspond to the LogFormat line writes to the log file.
|