[ Team LiB ] |
Recipe 3.19 Logging Activity to a MySQL DatabaseProblemRather than logging accesses to your server in flat text files, you want to log the information directly to a database for easier analysis. SolutionInstall the latest release of mod_log_sql from http://www.grubbybaby.com/mod_log_sql/ according to the modules directions (see Recipe 2.1), and then issue the following commands: # mysqladmin create apache_log # mysql apache_log # mysql apache_log < access_log.sql mysql> grant insert,create on apache_log.* to webserver@localhost identified by 'wwwpw'; Add the following lines to your httpd.conf file: <IfModule mod_log_mysql.c> MySQLLoginInfo localhost webserver wwwpw MySQLDatabase apache_log MySQLTransferLogTable access_log MySQLTransferLogFormat huSUsbTvRA </IfModule> DiscussionNote that there is currently a difference between the name of the web location, the tarball, and the actual module. The module file and directory retain the "mysql" name, but the directory and the tarball have moved to a more generic "sql" naming convention. See Also |
[ Team LiB ] |