Logging Apache in MySQL

I'm currently in process of rebuilding our web server cluster, and thought I would do some searching on improving how our configuration and logs are stored.  Little did I know there are some modules out there that can help us do that.

First, I have completed the logging piece of the puzzle and thought it was pretty cool and easy to setup.  You'll need to need to have the mysql client libraries installed along with libDBI.  Once you have these, you can quickly build the module and add it to Apache.

You can find the source here

Next you can find some simple build instructions here

Last you need to add the following to httpd.conf, make sure to change the Server Login Info

LoadModule log_sql_module modules/
LoadModule log_sql_mysql_module modules/
<IfModule mod_ssl.c>
LoadModule log_sql_ssl_module modules/

LogSQLLoginInfo mysql://user:pass@mysql_server_address/database
LogSQLCreateTables On

See more info here on additional configurations and customizing

After you give apache a restart and go to one of your virtual hosts in the browser, you should see the tables auto build with the log information.

Coming up next is mod_vhost_dbi, this will allow you to store your virtual host config in MySQL

No comments:

Post a Comment