[Mod_log_sql] X-Forwarded-For headers?

Paul Chvostek paul+modlogsql at it.ca
Fri Aug 13 00:36:59 EST 2004


On Sun, Aug 08, 2004 at 11:38:16PM -0500, Edward Rudd wrote:
> > 
> > LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
> > \"%{User-Agent}i\"" combined
...
> You can use the LogSQLWhichHeadersIn to log that header, be sure to also log
> Unique ID (from mod_unique_id) Another alternative, mod_log_sql 1.9x only,
> would be to write a sub-module for mod_log_sql to log the x-forwarded-for
> header into a new field. Look at the source code for mod_log_sql_ssl.c for an
> example.

Hrm...  Yes, I see how that would work, and it seems awfully awkward.
At the moment, I'm not planning any fancy relational databases, I merely
wanted modlogsql to aggregate log data from multiple web servers.  Data
would go into a single table, and I'd spit it out in combined format
when folks wanted to run log analysers.

In my particular case, the REMOTE_HOST is pointless, since all requests
must come from the load balancer.  So my preference would I suspect be
to replace the get_remote_host() function with something that returns
the content of X-Forwarded-For.  Alas, I'm not C programmer enough to do
it myself.  :(

I suppose another option would be to go the route of the separate table
for LogSQLWhichHeadersIn data, thenmerge that data back into the main
table in a batch that runs once a minute.

> I would categorize this under feature request.
> I will look into adding this into the core distribution.. I am working on
> redoing some of the code to determine what is logged.. as the current setup is
> rather cumbersome.

Do you have an approximate timeframe?  If it's soon (i.e. weeks rather
than months), I might just stall on this new server setup rather than
spend a bunch of time developing the workarounds.  ;-)

Thanks!

-- 
  Paul Chvostek                                             <paul at it.ca>
  Operations / Abuse / Whatever
  it.canada, hosting and development                   http://www.it.ca/




More information about the Mod_log_sql mailing list