diff -ru httpd-2.2.6/modules/loggers/mod_log_config.c httpd-2.2.6-new/modules/loggers/mod_log_config.c --- httpd-2.2.6/modules/loggers/mod_log_config.c 2006-07-12 05:38:44.000000000 +0200 +++ httpd-2.2.6-new/modules/loggers/mod_log_config.c 2007-09-18 11:54:35.000000000 +0200 @@ -95,6 +95,7 @@ * %...{format}P: the process ID or thread ID of the child/thread that * serviced the request * %...r: first line of request + * %...R: the port on the remote host * %...s: status. For requests that got internally redirected, this * is status of the *original* request --- %...>s for the last. * %...t: time, in common log format time format @@ -637,6 +638,13 @@ r->server->port ? r->server->port : ap_default_port(r)); } + +static const char *log_remote_port(request_rec *r, char *a) +{ + return apr_psprintf(r->pool, "%u", r->connection->remote_addr->port); +} + + /* This respects the setting of UseCanonicalName so that * the dynamic mass virtual hosting trick works better. */ @@ -1488,6 +1496,7 @@ log_pfn_register(p, "X", log_connection_status, 0); log_pfn_register(p, "C", log_cookie, 0); log_pfn_register(p, "r", log_request_line, 1); + log_pfn_register(p, "R", log_remote_port, 0); log_pfn_register(p, "D", log_request_duration_microseconds, 1); log_pfn_register(p, "T", log_request_duration, 1); log_pfn_register(p, "U", log_request_uri, 1);