MySQL with Apache
<a href="http://www.bodhosting.com/" target="_blank" title="SQL" style="color:#000000;text-decoration:none"><h1>MySQL with Apache</h1></a>
To authenticate users from MySQL database as well as write log files into MySQL table -
> Change Apache Logging format to make it readable by MySQL, this should be inserted in the Apache configuration file
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 a log file in the above format in MySQL, please make use of the following statement -
LOAD DATA INFILE '/local/access_log' INTO TABLE tbl_name
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
> A table which is name should be created in order to have columns that connect to the log format line writes to the log file.
|