Commit 6b15173a authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Add in useful feature. %k which logs the keepalives

value.
PR: 45762
        Dan Poirier <poirier@pobox.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@693120 13f79535-47bb-0310-9956-ffa450edef68
parent 5882615d
Loading
Loading
Loading
Loading
+4 −0
Changes for CHANGES: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@
Changes with Apache 2.3.0
[ When backported to 2.2.x, remove entry from this file ]

  *) Add new LogFormat parameter, %k, which logs the number of
     keepalive requests on this connection for this request..
     [Dan Poirier <poirier pobox.com>]

  *) Be tolerant in what you accept - accept slightly broken
     status lines from a backend provide they include a valid status code.
     PR 44995 [Rainer Jung <rainer.jung kippdata.de>
+5 −0
Changes for docs/manual/mod/mod_log_config.xml: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -107,6 +107,11 @@
        <td>The contents of <code><var>Foobar</var>:</code> header line(s)
        in the request sent to the server.</td></tr>

    <tr><td><code>%k</code></td>
        <td>Number of requests handled on this connection.  Interesting if
          <directive module="core">KeepAlive</directive> is being used;
          otherwise this is always 0.</td></tr>

    <tr><td><code>%l</code></td>
        <td>Remote logname (from identd, if supplied). This will return a
        dash unless <module>mod_ident</module> is present and <directive
+7 −0
Changes for modules/loggers/mod_log_config.c: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@
 * %...A:  local IP-address
 * %...{Foobar}i:  The contents of Foobar: header line(s) in the request
 *                 sent to the client.
 * %...k:  number of requests served over this connection
 * %...l:  remote logname (from identd, if supplied)
 * %...{Foobar}n:  The contents of note "Foobar" from another module.
 * %...{Foobar}o:  The contents of Foobar: header line(s) in the reply.
@@ -694,6 +695,11 @@ static const char *log_connection_status(request_rec *r, char *a)
    return "-";
}

static const char *log_requests_on_connection(request_rec *r, char *a)
{
    return apr_itoa(r->pool, r->connection->keepalives);
}

/*****************************************************************
 *
 * Parsing the log format string
@@ -1498,6 +1504,7 @@ static int log_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
        log_pfn_register(p, "q", log_request_query, 0);
        log_pfn_register(p, "X", log_connection_status, 0);
        log_pfn_register(p, "C", log_cookie, 0);
        log_pfn_register(p, "k", log_requests_on_connection, 0);
        log_pfn_register(p, "r", log_request_line, 1);
        log_pfn_register(p, "D", log_request_duration_microseconds, 1);
        log_pfn_register(p, "T", log_request_duration, 1);