You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by George Michaelson <gg...@dstc.edu.au> on 1998/05/25 02:14:07 UTC

mod_log-any/2276: mod_log_config can't log IP address unless DNS is disabled or failed.

>Number:         2276
>Category:       mod_log-any
>Synopsis:       mod_log_config can't log IP address unless DNS is disabled or failed.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Sun May 24 17:20:00 PDT 1998
>Last-Modified:
>Originator:     ggm@dstc.edu.au
>Organization:
apache
>Release:        1.2.6 et seq
>Environment:
Any. (new feature)	
>Description:
DNS address is interesting but not 'canonical' enough for flow based
charging and reconciliation. 10% + of hosts don't have DNS names, and
of those that do, a significant number can't be reverse-looked up to their
IP address within 1 week of being used (dynamic pools etc)

I have therefore modified mod_log_config.c to include a new  %I directive
to log the IP address, which is held in the r_>connection block anyway.

The code is very simple.

>How-To-Repeat:

>Fix:
Here is the code:  add to log_item_keys

    { 'I', log_remote_addr, 0 },

and add to the function lists
char *log_remote_addr (request_rec *r, char *a)
{
   char dummy[16];

   return pstrdup(r->pool, inet_ntoa(r->connection->remote_addr.sin_addr));
};

It just works! I'm using this with a modified filter on analog to parse
common logformat files, and sort/grade using IP address while still being
able to count DNS name
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]