What is the recommended approach to import Apache access log into a MySQL table? I am thinking of a ruby/perl script + a cron job. It'll be great if there is an example or reference.
I am not sure how to handle the bookmarking of the last log entry in last import either. Suggestions are welcome. Thanks!
Do you own the customlog format? Or do you have to live with whatever is there? if you own the format you can easily delimit the fields (with tabs for example) and its pretty trivial to import.
LogFormat "%{%Y-%m-%d %H:%M:%S}t\t%s\t%h\t%{ClientIP}i\t%U%q\t%{Host}i\t%B\tc1w1402@dc1app14\t%m\t%{User-Agent}i\t%{Referer}i\tDRH\t%T\t%f\t%{Via}i" ezimport
If you can write PERL script then try out mod_perl to log directly to database... for the reference check link .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With