]> granicus.if.org Git - apache/commitdiff
Merge forward mod_log_config enhancement.
authorBill Stoddard <stoddard@apache.org>
Fri, 3 Nov 2000 03:00:57 +0000 (03:00 +0000)
committerBill Stoddard <stoddard@apache.org>
Fri, 3 Nov 2000 03:00:57 +0000 (03:00 +0000)
Added three log methods: CLF compliant '-' byte count, method and protocol.

CVg:   then name the system in this line, otherwise delete it.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86818 13f79535-47bb-0310-9956-ffa450edef68

modules/loggers/mod_log_config.c

index e2813fe606871c1483c9e10cf607d0f0dff5fa64..c48d545a86121425714b1341b6a0e581382042a8 100644 (file)
  * 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'.
  * %...c:  Status of the connection.
  *         'X' = connection aborted before the response completed.
  *         '+' = connection may be kept alive after the response is sent.
  * %...U:  the URL path requested.
  * %...v:  the configured name of the server (i.e. which virtual host?)
  * %...V:  the server name according to the UseCanonicalName setting
+ * %...m:  the request method
+ * %...h:  the request protocol
  *
  * The '...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can
  * indicate conditions for inclusion of the item (which will cause it
@@ -345,12 +349,20 @@ static const char *log_request_uri(request_rec *r, char *a)
 {
     return r->uri;
 }
+static const char *log_request_method(request_rec *r, char *a)
+{
+    return r->method;
+}
+static const char *log_request_protocol(request_rec *r, char *a)
+{
+    return r->protocol;
+}
 static const char *log_status(request_rec *r, char *a)
 {
     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 "-";
@@ -362,6 +374,19 @@ static const char *log_bytes_sent(request_rec *r, char *a)
     }
 }
 
+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 apr_psprintf(r->pool, "%ld", bs);
+    }
+}
+
+
 static const char *log_header_in(request_rec *r, char *a)
 {
     return apr_table_get(r->headers_in, a);
@@ -524,7 +549,10 @@ static struct log_item_list {
         's', log_status, 1
     },
     {
-        'b', log_bytes_sent, 0
+        'b', clf_log_bytes_sent, 0
+    },
+    {
+        'B', log_bytes_sent, 0
     },
     {
         'i', log_header_in, 0
@@ -550,6 +578,12 @@ static struct log_item_list {
     {
         'P', log_child_pid, 0
     },
+    {
+        'H', log_request_protocol, 0
+    },
+    {
+        'm', log_request_method, 0
+    },
     {
         'c', log_connection_status, 0
     },