From d9e659b18fb51d6b51582162707f1a9486bb1b76 Mon Sep 17 00:00:00 2001 From: Christophe Jaillet Date: Tue, 21 May 2013 19:26:10 +0000 Subject: [PATCH] mod_logio: new format-specifier %C (combined) which is the sum of received and sent byte counts. PR54015 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1484910 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ docs/manual/mod/mod_log_config.xml | 6 ++++++ docs/manual/mod/mod_logio.xml | 8 ++++++-- modules/loggers/mod_logio.c | 9 +++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 94ce4b77ed..41c503144d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_logio: new format-specifier %C (combined) which is the sum of received + and sent byte counts. + PR54015 [Christophe Jaillet] + *) core: Remove apr_brigade_flatten(), buffering and duplicated code from the HTTP_IN filter, parse chunks in a single pass with zero copy. Reduce memory usage by 48 bytes per request. [Graham Leggett] diff --git a/docs/manual/mod/mod_log_config.xml b/docs/manual/mod/mod_log_config.xml index 6c17f7786e..a5a68cc1e7 100644 --- a/docs/manual/mod/mod_log_config.xml +++ b/docs/manual/mod/mod_log_config.xml @@ -254,6 +254,12 @@ %O Bytes sent, including headers. Cannot be zero. You need to enable mod_logio to use this. + + %C + 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..7accb1ae38 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. + + %C + 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..c0ae7a11c6 100644 --- a/modules/loggers/mod_logio.c +++ b/modules/loggers/mod_logio.c @@ -108,6 +108,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 +178,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, "C", log_bytes_combined, 0); } return OK; -- 2.40.0