This patch will change the behavior of mod_log_config so that it logs
'0' bytes sendt instead of '-' when no body is sendt.
The reason for the change is that 0 is a lot more practical to use for
calculations, and that '-' won't fit as an integer in our SQL-database.
I've not investigated if the whole if (!r->sent_bodyct) could be
removed.
This is a patch against apache 1.3.6.
--- apache_1.3.6.orig/src/modules/standard/mod_log_config.c Mon Aug 16 09:11:26 1999
+++ apache_1.3.6/src/modules/standard/mod_log_config.c Mon Aug 16 09:12:45 1999
@@ -336,7 +336,7 @@
static const char *log_bytes_sent(request_rec *r, char *a)
{
if (!r->sent_bodyct) {
- return "-";
+ return "0";
}
else {
long int bs;
Ragnar Kjørstad
Vest Internett
Yes.
> -----Original Message-----
> From: new-httpd-owner@apache.org
> [mailto:new-httpd-owner@apache.org]On
> Behalf Of Dirk-Willem van Gulik
> Sent: Tuesday, August 17, 1999 3:35 PM
> To: new-httpd@apache.org
> Subject: Re: [PATCH] Logging: no bytes sendt as '0' instead of '-'
>
>
>
>
> Perhaps we need a 'B' as well as a 'b'; i.e. one in CLF
> and one sensible one.
>
> Dw.
>
> Index: mod_log_config.c
> ===================================================================
> RCS file:
> /x3/home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v
> retrieving revision 1.78
> diff -u -r1.78 mod_log_config.c
> --- mod_log_config.c 1999/06/22 00:51:35 1.78
> +++ mod_log_config.c 1999/08/17 20:33:54
> @@ -117,7 +117,9 @@
> * literal characters copied into the log files, and '%'
> directives as
> * follows:
> *
> - * %...b: bytes sent, excluding HTTP headers.
> + * %...B: bytes sent, excluding HTTP headers.
> + * %...b: bytes sent, excluding HTTP headers in CLF
> format, i.e. a '-'
> + * when no bytes where sent (rather than a '0'.
> * %...{FOOBAR}e: The contents of the environment variable FOOBAR
> * %...f: filename
> * %...h: remote host
> @@ -339,7 +341,7 @@
> return pfmt(r->pool, r->status);
> }
>
> -static const char *log_bytes_sent(request_rec *r, char *a)
> +static const char *clf_log_bytes_sent(request_rec *r, char *a)
> {
> if (!r->sent_bodyct) {
> return "-";
> @@ -351,6 +353,19 @@
> }
> }
>
> +static const char *log_bytes_sent(request_rec *r, char *a)
> +{
> + if (!r->sent_bodyct) {
> + return "0";
> + }
> + else {
> + long int bs;
> + ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
> + return ap_psprintf(r->pool, "%ld", bs);
> + }
> +}
> +
> +
> static const char *log_header_in(request_rec *r, char *a)
> {
> return ap_table_get(r->headers_in, a);
> @@ -479,8 +494,11 @@
> {
> 's', log_status, 1
> },
> + {
> + 'b', clf_log_bytes_sent, 0
> + },
> {
> - 'b', log_bytes_sent, 0
> + 'B', log_bytes_sent, 0
> },
> {
> 'i', log_header_in, 0
>
> Dw.
>
> On Tue, 17 Aug 1999, Dean Gaudet wrote:
>
> > The common log format (CLF) requires the -.
> >
> > CLF is dumb anyhow, but that at least explains why the
> silliness is there.
> >
> > Dean
> >
> > On Mon, 16 Aug 1999, Ragnar Kjørstad wrote:
> >
> > > This patch will change the behavior of mod_log_config
> so that it logs
> > > '0' bytes sendt instead of '-' when no body is sendt.
> > >
> > > The reason for the change is that 0 is a lot more
> practical to use for
> > > calculations, and that '-' won't fit as an integer in
> our SQL-database.
> > >
> > > I've not investigated if the whole if (!r->sent_bodyct) could be
> > > removed.
> > >
> > > This is a patch against apache 1.3.6.
> > >
> > >
> > >
> > > ---
> apache_1.3.6.orig/src/modules/standard/mod_log_config.c
> Mon Aug 16 09:11:26 1999
> > > +++ apache_1.3.6/src/modules/standard/mod_log_config.c
> Mon Aug 16 09:12:45 1999
> > > @@ -336,7 +336,7 @@
> > > static const char *log_bytes_sent(request_rec *r, char *a)
> > > {
> > > if (!r->sent_bodyct) {
> > > - return "-";
> > > + return "0";
> > > }
> > > else {
> > > long int bs;
> > >
> > >
> > >
> > >
> > >
> > > Ragnar Kjørstad
> > > Vest Internett
> > >
> >
> >
>
Perhaps we need a 'B' as well as a 'b'; i.e. one in CLF
and one sensible one.
Dw.
Index: mod_log_config.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v
retrieving revision 1.78
diff -u -r1.78 mod_log_config.c
--- mod_log_config.c 1999/06/22 00:51:35 1.78
+++ mod_log_config.c 1999/08/17 20:33:54
@@ -117,7 +117,9 @@
* literal characters copied into the log files, and '%' directives as
* follows:
*
- * %...b: bytes sent, excluding HTTP headers.
+ * %...B: bytes sent, excluding HTTP headers.
+ * %...b: bytes sent, excluding HTTP headers in CLF format, i.e. a '-'
+ * when no bytes where sent (rather than a '0'.
* %...{FOOBAR}e: The contents of the environment variable FOOBAR
* %...f: filename
* %...h: remote host
@@ -339,7 +341,7 @@
return pfmt(r->pool, r->status);
}
-static const char *log_bytes_sent(request_rec *r, char *a)
+static const char *clf_log_bytes_sent(request_rec *r, char *a)
{
if (!r->sent_bodyct) {
return "-";
@@ -351,6 +353,19 @@
}
}
+static const char *log_bytes_sent(request_rec *r, char *a)
+{
+ if (!r->sent_bodyct) {
+ return "0";
+ }
+ else {
+ long int bs;
+ ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
+ return ap_psprintf(r->pool, "%ld", bs);
+ }
+}
+
+
static const char *log_header_in(request_rec *r, char *a)
{
return ap_table_get(r->headers_in, a);
@@ -479,8 +494,11 @@
{
's', log_status, 1
},
+ {
+ 'b', clf_log_bytes_sent, 0
+ },
{
- 'b', log_bytes_sent, 0
+ 'B', log_bytes_sent, 0
},
{
'i', log_header_in, 0
Dw.
On Tue, 17 Aug 1999, Dean Gaudet wrote:
> The common log format (CLF) requires the -.
>
> CLF is dumb anyhow, but that at least explains why the silliness is there.
>
> Dean
>
> On Mon, 16 Aug 1999, Ragnar Kj�rstad wrote:
>
> > This patch will change the behavior of mod_log_config so that it logs
> > '0' bytes sendt instead of '-' when no body is sendt.
> >
> > The reason for the change is that 0 is a lot more practical to use for
> > calculations, and that '-' won't fit as an integer in our SQL-database.
> >
> > I've not investigated if the whole if (!r->sent_bodyct) could be
> > removed.
> >
> > This is a patch against apache 1.3.6.
> >
> >
> >
> > --- apache_1.3.6.orig/src/modules/standard/mod_log_config.c Mon Aug 16 09:11:26 1999
> > +++ apache_1.3.6/src/modules/standard/mod_log_config.c Mon Aug 16 09:12:45 1999
> > @@ -336,7 +336,7 @@
> > static const char *log_bytes_sent(request_rec *r, char *a)
> > {
> > if (!r->sent_bodyct) {
> > - return "-";
> > + return "0";
> > }
> > else {
> > long int bs;
> >
> >
> >
> >
> >
> > Ragnar Kj�rstad
> > Vest Internett
> >
>
>
The common log format (CLF) requires the -.
CLF is dumb anyhow, but that at least explains why the silliness is there.
Dean
On Mon, 16 Aug 1999, Ragnar Kjørstad wrote:
> This patch will change the behavior of mod_log_config so that it logs
> '0' bytes sendt instead of '-' when no body is sendt.
>
> The reason for the change is that 0 is a lot more practical to use for
> calculations, and that '-' won't fit as an integer in our SQL-database.
>
> I've not investigated if the whole if (!r->sent_bodyct) could be
> removed.
>
> This is a patch against apache 1.3.6.
>
>
>
> --- apache_1.3.6.orig/src/modules/standard/mod_log_config.c Mon Aug 16 09:11:26 1999
> +++ apache_1.3.6/src/modules/standard/mod_log_config.c Mon Aug 16 09:12:45 1999
> @@ -336,7 +336,7 @@
> static const char *log_bytes_sent(request_rec *r, char *a)
> {
> if (!r->sent_bodyct) {
> - return "-";
> + return "0";
> }
> else {
> long int bs;
>
>
>
>
>
> Ragnar Kjørstad
> Vest Internett
>