Logging into SQL with apache2 or nginx

I’ve been playing around this weekend with my webservers because some PHP coders want to see the accesslog of a few virtualhosts in SQL. In different databases, to be on the fun side. Apache2 has two options:

  • mod_log_sql does not support logging into different database servers per virtualhost, and also sports a static table layout, which is not necessarily nice. Could be used in other configs, but *trash*.
  • mod_log_mysql seems to be nice on the first spot, but then it gets out that one has to rebuild the Apache binaries with the modified mod_log_config the project provides. Hell wants an if-you-want-an-uprade-rebuild-everything nightmare, even in chroots. *trash*
  • Nginx has a patchset which allows the server to log into syslog, then in turn into syslog-ng, but since it has no configuration options – hardcoded syslog facility, no per-vhost config -, it seems promising, but *trash*

Now I seem to end up in using a script which parses the accesslog with tail -f and inserts the entries into SQL. Fuck what?

Leave a Reply