You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by jon drukman <js...@gamespot.com> on 1998/08/03 22:39:25 UTC

mod_log-any/2772: more % escapes

>Number:         2772
>Category:       mod_log-any
>Synopsis:       more % escapes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Mon Aug  3 13:40:00 PDT 1998
>Last-Modified:
>Originator:     jsd@gamespot.com
>Organization:
apache
>Release:        1.3.1
>Environment:
FreeBSD hudsucker.gamespot.com 2.2.5-RELEASE FreeBSD 2.2.5-RELEASE #0: Thu Feb 19 15:41:29 PST 1998     jsd@hudsucker.gamespot.com:/usr/src/sys/compile/HUDSUCKER  i386
>Description:
I would like to have two more % escapes added to mod_log_config.c.

%m - request method
%c - request protocol

this way, you can construct a custom "GET /uri HTTP/1.0" type entry.  we use
this extensively in house.

also - i have patched log_request_uri to have the query string in the logfile
if one was specified.  i'm not sure what the best way is to get that in the
program.  perhaps yet another % escape to do it?  let me know what you think.
>How-To-Repeat:

>Fix:
here's my patch for the first two escapes, against the 1.3.1 source:

*** mod_log_config.c.orig       Mon Aug  3 10:23:54 1998
--- mod_log_config.c    Mon Aug  3 10:34:39 1998
***************
*** 420,425 ****
--- 420,433 ----
  {
      return ap_psprintf(r->pool, "%ld", (long) getpid());
  }
+ char *log_method (request_rec *r, char *a)
+ {
+   return r->method;
+ }
+ char *log_protocol (request_rec *r, char *a)
+ {
+   return r->protocol;
+ }

  /*****************************************************************
   *
***************
*** 485,490 ****
--- 493,504 ----
      },
      {
          'P', log_child_pid, 0
+     },
+     {
+         'm', log_method, 0
+     },
+     {
+         'c', log_protocol, 0
      },
      {
          '\0'
>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. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]