[Mod_log_sql] LogSQLMassVirtualHosting and mod_vhost_alias

Jorey Bump list at joreybump.com
Sun Jan 22 11:27:14 EST 2006

Bob Apthorpe wrote:

> Basically, if you match an xLD (top, second, third, fourth-level
> domain), /(([^.]+\.)(xLD))$/ should match the base domain where you'd
> store the log entry. www.example.co.uk and example.co.uk would match the
> 2LD '.co.uk' giving a base domain of example.co.uk for both. Similarly,
> www.example.austin.ci.tx.us and example.austin.ci.tx.us would end up
> under austin.ci.tx.us.

This use case is common, but the fix isn't flexible enough for all kinds 
of mass virtual hosting. For example, one might want to aggregate the 
results for www.example.net & www.example.com, or www.example.com & 
www.example.co.uk. Counting back from the TLD seems insufficient.

There should be support for arbitrarily combining results based on any 
combination of parts from the hostname in the request (select all 
requests to .com domains, or to any host with "example" as part of the 

How are people aggregating results with the current system (assuming 
separate tables for hosts)? Should there be an index table that hashes 
the parts of hostnames on the system, for easy discovery of table names 
to use in queries? What internal support does Apache provide that can be 
used to achieve this, such as  Directory Name Interpolation?


The solution to this problem should at least be as flexible as is 
possible with mass virtual hosting (and then some), and should attempt 
to match or leverage Apache internals, as well.

More information about the Mod_log_sql mailing list