Re: Logging environment variables

Edward rudd <[email protected]> Thu, 24 Nov 2005 10:51:52 -0500
Newsgroups gmane.comp.apache.mod-log-sql
Organization OutOfOrder.cc
Message-ID <[email protected]>
On Thu, 2005-11-24 at 14:56 +0000, Mike Cardwell wrote:
> * on the Thu, Nov 24, 2005 at 10:17:38AM +0000, Mike Cardwell wrote:
> 
> > I have a setup whereby there is a single virtual host that serves many
> > sites. Rewrite rules are used to map a hostname to a path for the
> > document root. I set the environment variable VHOST to be a slightly
> > modified copy of HTTP_HOST.
> > 
> > Example:
> > 
> > If an incoming request comes in for foo.com or anything.foo.com
> > or anything.anything.foo.com I want to only log foo.com. The VHOST
> > variable is set to the correct value. I can log this to disk with:
 
[snip]

I actually do have this kind of feature on my todolist.  Not the
environment variables, but rather the munging of hostnames, so only
foo.com can be logged, and also logging anything.anything.foo.com and
anything.foo.com into foo.com's single long table when mass virtual
hosting is on in mod_log_sql.

> I've found a solution. In functions.h, in either extract_virtual_host or
> extract_server_name depending on if you're using the 'v' or the 'V'
> option, you simply change the contents of that subroutine to:
> 
> return apr_table_get( r->subprocess_env, "VHOST" );

That'll do it as a quick solution

> Now I've got it working I think I'll write a more elegant solution.
> That would have taken a C programmer 2 minutes to find and write ;)

_______________________________________________
Download the latest version at http://www.outoforder.cc/projects/apache/mod_log_sql/

To unsubscribe send an e-mail to 
mod_log_sql-unsubscribe-7qY7E20V6GW73k+5HYS8LQqVMODqnSLI@public.gmane.org
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBDheGYvwMxRUUct20RArGzAJ9ZNp7cinVFUmbJ+y7I55HxVtW0xgCfdy+0
zZSJ/kHGS4EOn5vlf/KDgTw=
=XERh
-----END PGP SIGNATURE-----