From: Bill Stoddard Date: Fri, 3 Nov 2000 03:00:57 +0000 (+0000) Subject: Merge forward mod_log_config enhancement. X-Git-Tag: APACHE_2_0_ALPHA_8~182 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e905ec9a274cb790ef56b5b721b8bf9761610673;p=apache Merge forward mod_log_config enhancement. 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 --- diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index e2813fe606..c48d545a86 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -118,7 +118,9 @@ * 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. @@ -146,6 +148,8 @@ * %...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 },