开发者

How to import Apache access log into MySQL table?

开发者 https://www.devze.com 2023-01-12 10:49 出处:网络
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.

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.

开发者_C百科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 .


LogFormat "yourFormat" yourLog

<VirtualHost example.com>
    ServerName example.com
    CustomLog /yourPath yourLog
</VirtualHost>
0

精彩评论

暂无评论...
验证码 换一张
取 消