You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@covalent.net> on 1997/11/19 21:00:21 UTC

[PATCH] Another note on logging changes

Working to include some changes that allow logging to a central 
database. Seems that logging a '-' for bytes sent when it == 0 is a 
bug since we are trying to copy this data to integer fields in a 
database. My guess is that changing this to log a '0' would cause 
some other people grief. I've made a small change to 
mod_log_config.c which allows you to specify %{int}b to log a '0' 
intstead of '-'. It defaults to '-'.

Index: mod_log_config.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_log_config.c,v
retrieving revision 1.41
diff -c -r1.41 mod_log_config.c
*** mod_log_config.c	1997/10/22 20:30:24	1.41
--- mod_log_config.c	1997/11/19 19:48:45
***************
*** 113,119 ****
   * literal characters copied into the log files, and '%' directives as
   * follows:
   *
!  * %...b:  bytes sent, excluding HTTP headers.
   * %...{FOOBAR}e:  The contents of the environment variable FOOBAR
   * %...f:  filename
   * %...h:  remote host
--- 113,120 ----
   * literal characters copied into the log files, and '%' directives as
   * follows:
   *
!  * %...b:  bytes sent, excluding HTTP headers. %{int}b logs zero bytes sent
!  *         as a '0' instead of '-'.
   * %...{FOOBAR}e:  The contents of the environment variable FOOBAR
   * %...f:  filename
   * %...h:  remote host
***************
*** 314,320 ****
  
  static char *log_bytes_sent(request_rec *r, char *a)
  {
!     if (!r->sent_bodyct) {
          return "-";
      }
      else {
--- 315,324 ----
  
  static char *log_bytes_sent(request_rec *r, char *a)
  {
!     if (!r->sent_bodyct && !strcasecmp(a, "int")) {
!         return "0";
!     }
!     else if (!r->sent_bodyct) {
          return "-";
      }
      else {



Re: [PATCH] Another note on logging changes

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Wed, Nov 19, 1997 at 02:00:21PM -0600, Randy Terbush wrote:
> Working to include some changes that allow logging to a central 
> database. Seems that logging a '-' for bytes sent when it == 0 is a 
> bug since we are trying to copy this data to integer fields in a 
> database.
+1, even though a postprocessor (->piped logs) could do that as well.

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Another note on logging changes

Posted by Brian Behlendorf <br...@organic.com>.
At 01:50 PM 11/19/97 -0800, Dean Gaudet wrote:
>I'm not going to veto this.  But it seems silly to just poke away at lame
>common log format legacy without going the whole distance.  For example,
>there is no way with mod_log_config to write a log in which all the fields
>are discernable from each other just by splitting on a field delimiter.
>i.e. if I want to use | to separate fields in the log, there's no way for
>me to ensure that one of the client-supplied fields won't contain a pipe.
>A fix for this is the ability to log fields with % escaping (need to
>escape % and the field delimiter only). 

+1 on concept.  I currently use | to separate fields, and in my
post-processing I toss out logfile entries which have an unexpected format,
usually caused by a '|' in a URL.  The only situation I've seen this used
is the infernal "Count.cgi" program everyone uses.

	Brian



--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
"it's a big world, with lots of records to play." - sig   brian@organic.com

Re: [PATCH] Another note on logging changes

Posted by Dean Gaudet <dg...@arctic.org>.
+0

I'm not going to veto this.  But it seems silly to just poke away at lame
common log format legacy without going the whole distance.  For example,
there is no way with mod_log_config to write a log in which all the fields
are discernable from each other just by splitting on a field delimiter.
i.e. if I want to use | to separate fields in the log, there's no way for
me to ensure that one of the client-supplied fields won't contain a pipe.
A fix for this is the ability to log fields with % escaping (need to
escape % and the field delimiter only). 

What about log_status, which will also put a - in for 0? 

Dean

On Wed, 19 Nov 1997, Randy Terbush wrote:

> 
> Working to include some changes that allow logging to a central 
> database. Seems that logging a '-' for bytes sent when it == 0 is a 
> bug since we are trying to copy this data to integer fields in a 
> database. My guess is that changing this to log a '0' would cause 
> some other people grief. I've made a small change to 
> mod_log_config.c which allows you to specify %{int}b to log a '0' 
> intstead of '-'. It defaults to '-'.
> 
> Index: mod_log_config.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/modules/standard/mod_log_config.c,v
> retrieving revision 1.41
> diff -c -r1.41 mod_log_config.c
> *** mod_log_config.c	1997/10/22 20:30:24	1.41
> --- mod_log_config.c	1997/11/19 19:48:45
> ***************
> *** 113,119 ****
>    * literal characters copied into the log files, and '%' directives as
>    * follows:
>    *
> !  * %...b:  bytes sent, excluding HTTP headers.
>    * %...{FOOBAR}e:  The contents of the environment variable FOOBAR
>    * %...f:  filename
>    * %...h:  remote host
> --- 113,120 ----
>    * literal characters copied into the log files, and '%' directives as
>    * follows:
>    *
> !  * %...b:  bytes sent, excluding HTTP headers. %{int}b logs zero bytes sent
> !  *         as a '0' instead of '-'.
>    * %...{FOOBAR}e:  The contents of the environment variable FOOBAR
>    * %...f:  filename
>    * %...h:  remote host
> ***************
> *** 314,320 ****
>   
>   static char *log_bytes_sent(request_rec *r, char *a)
>   {
> !     if (!r->sent_bodyct) {
>           return "-";
>       }
>       else {
> --- 315,324 ----
>   
>   static char *log_bytes_sent(request_rec *r, char *a)
>   {
> !     if (!r->sent_bodyct && !strcasecmp(a, "int")) {
> !         return "0";
> !     }
> !     else if (!r->sent_bodyct) {
>           return "-";
>       }
>       else {
> 
> 
>