Pages

12/08/2010

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
http://www.outoforder.cc/projects/apache/mod_log_sql/

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/mod_log_sql.so
LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so
<IfModule mod_ssl.c>
LoadModule log_sql_ssl_module modules/mod_log_sql_ssl.so
</IfModule>

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

See more info here on additional configurations and customizing
http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/

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