[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: can apache log to MySQL ?



> 
> another way to do it is to write a small perl (or whatever) program
> which reads apache log entries on stdin and injects them into a database
> - should be less than 20 lines of perl using DBI.
> 

   but the problem is, i cant code in PERL :-(

   any good souls out there who have the free time to write that 20 lines of code ?  :-)

cheers,
chad

PS.  i recently found out that you can actually use mysql itself to read a datafile and inject it to some table.  that can be done by:

LOAD DATA INFILE '/var/log/apache/access.log' INTO TABLE table_name
FIELDS TERMINATED BY ' ' OPTIONALLY ENCLOSED BY '"';

since apache logs "date/time" (%t in apaches LogFormat) inside an "[" and an "]", i replaced all "[]"'s w/ an '"' ...  everything seemed to have worked very well and very smoothly until i found out that some User-Agent logs contains something like ""Mozilla/4.6 "en" (Win95; I)"" ...  the "en" thingy confused that MySQL directive :-( ...  any inputs anyone ???

thanks again.



Reply to: