From: Graham Leggett Date: Sat, 14 Sep 2013 15:25:11 +0000 (+0000) Subject: mod_logio: new format-specifier %S (sum) which is the sum of received X-Git-Tag: 2.4.7~221 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8ef52f780d9cbc45b53525c5d19344bd81c75b3;p=apache mod_logio: new format-specifier %S (sum) which is the sum of received and sent byte counts. PR54015 [Martijn T. , Christophe JAILLET] trunk: http://svn.apache.org/r1484910 http://svn.apache.org/r1517386 Submitted by: jailletc36 Reviewed by: jim, humbedooh git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1523269 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 547f8a909d..803581396e 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.4.7 + *) mod_logio: new format-specifier %C (combined) which is the sum of received + and sent byte counts. + PR54015 [Christophe Jaillet] + *) mod_deflate: Improve error detection when decompressing request bodies with trailing garbage: handle case where trailing bytes are in the same bucket. [Rainer Jung] diff --git a/STATUS b/STATUS index fe33a36b58..1a2a5e5164 100644 --- a/STATUS +++ b/STATUS @@ -110,14 +110,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: 2.4.x patch: trunk works, if 1496338 above is merged first. +1: covener, jim, humbedooh - * mod_logio: new format-specifier %S (sum) which is the sum of received - and sent byte counts. - PR54015 [Martijn T. , Christophe JAILLET] - trunk: http://svn.apache.org/r1484910 - http://svn.apache.org/r1517386 - 2.4.x patch: trunk patch works - +1: jailletc36, jim, humbedooh - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/docs/manual/mod/mod_log_config.xml b/docs/manual/mod/mod_log_config.xml index 2bfa875638..a503aa52da 100644 --- a/docs/manual/mod/mod_log_config.xml +++ b/docs/manual/mod/mod_log_config.xml @@ -255,6 +255,12 @@ %O Bytes sent, including headers. Cannot be zero. You need to enable mod_logio to use this. + + %S + Bytes transferred (received and sent), including request and headers, + cannot be zero. This is the combination of %I and %O. You need to + enable mod_logio to use this. +
Modifiers diff --git a/docs/manual/mod/mod_logio.xml b/docs/manual/mod/mod_logio.xml index 905b1eab20..e7acb12940 100644 --- a/docs/manual/mod/mod_logio.xml +++ b/docs/manual/mod/mod_logio.xml @@ -61,12 +61,16 @@ Format String Description - %...I + %I Bytes received, including request and headers, cannot be zero. - %...O + %O Bytes sent, including headers, cannot be zero. + + %S + Bytes transferred (received and sent), including request and headers, + cannot be zero. This is the combination of %I and %O.

Usually, the functionality is used like this:

diff --git a/modules/loggers/mod_logio.c b/modules/loggers/mod_logio.c index f58c2922d3..ad387a9b1b 100644 --- a/modules/loggers/mod_logio.c +++ b/modules/loggers/mod_logio.c @@ -15,15 +15,7 @@ */ /* - * Written by Bojan Smojver : - * - * The argument to LogFormat and CustomLog is a string, which can include - * literal characters copied into the log files, and '%' directives as - * follows: - * - * %...I: bytes received, including request and headers, cannot be zero - * %...O: bytes sent, including headers, cannot be zero - * + * Written by Bojan Smojver . */ #include "apr_strings.h" @@ -108,6 +100,14 @@ static const char *log_bytes_out(request_rec *r, char *a) return apr_off_t_toa(r->pool, cf->bytes_out); } +static const char *log_bytes_combined(request_rec *r, char *a) +{ + logio_config_t *cf = ap_get_module_config(r->connection->conn_config, + &logio_module); + + return apr_off_t_toa(r->pool, cf->bytes_out + cf->bytes_in); +} + /* * Reset counters after logging... */ @@ -170,6 +170,7 @@ static int logio_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) if (log_pfn_register) { log_pfn_register(p, "I", log_bytes_in, 0); log_pfn_register(p, "O", log_bytes_out, 0); + log_pfn_register(p, "S", log_bytes_combined, 0); } return OK;