]> granicus.if.org Git - apache/commitdiff
mod_logio: new format-specifier %S (sum) which is the sum of received
authorGraham Leggett <minfrin@apache.org>
Sat, 14 Sep 2013 15:25:11 +0000 (15:25 +0000)
committerGraham Leggett <minfrin@apache.org>
Sat, 14 Sep 2013 15:25:11 +0000 (15:25 +0000)
and sent byte counts.
PR54015 [Martijn T. <apache_bugzilla@mindcontrolled.nl>, 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

CHANGES
STATUS
docs/manual/mod/mod_log_config.xml
docs/manual/mod/mod_logio.xml
modules/loggers/mod_logio.c

diff --git a/CHANGES b/CHANGES
index 547f8a909d20e2039148e0bef96c2e2a16a4c253..803581396e6eb00b5e28561118568f3eae9f378d 100644 (file)
--- 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 fe33a36b58d6b719670ce610f67bd92c1e2d0902..1a2a5e516482055af810ef9c563100cc2354c82a 100644 (file)
--- 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. <apache_bugzilla@mindcontrolled.nl>, 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 ]
index 2bfa8756383ab54fa88d79e55a39de1b187a8e04..a503aa52da0ea13cd43fdc5d71b45af50c571a8d 100644 (file)
     <tr><td><code>%O</code></td>
         <td>Bytes sent, including headers. Cannot be zero. You need to
         enable <module>mod_logio</module> to use this.</td></tr>
+
+    <tr><td><code>%S</code></td>
+        <td>Bytes transferred (received and sent), including request and headers,
+        cannot be zero. This is the combination of %I and %O. You need to
+        enable <module>mod_logio</module> to use this.</td></tr>
+
     </table>
 
     <section id="modifiers"><title>Modifiers</title>
index 905b1eab205f269dd065b877e6bfadce646b76ba..e7acb12940373bd646a4fe5235a3a4b1625d5838 100644 (file)
     <tr><th>Format&nbsp;String</th>
         <th>Description</th></tr>
 
-    <tr><td><code>%...I</code></td>
+    <tr><td><code>%I</code></td>
         <td>Bytes received, including request and headers, cannot be
         zero.</td></tr>
 
-    <tr><td><code>%...O</code></td>
+    <tr><td><code>%O</code></td>
         <td>Bytes sent, including headers, cannot be zero.</td></tr>
+
+    <tr><td><code>%S</code></td>
+        <td>Bytes transferred (received and sent), including request and headers,
+        cannot be zero. This is the combination of %I and %O.</td></tr>
     </table>
 
     <p>Usually, the functionality is used like this:</p>
index f58c2922d3e9807308e062f1d840b65c15d535ce..ad387a9b1b64ab6fee4f947e788bf190484bffc5 100644 (file)
  */
 
 /*
- * Written by Bojan Smojver <bojan rexursive.com>:
- *
- * 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 <bojan rexursive.com>.
  */
 
 #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;