dirkx 99/09/27 13:38:52
Modified: src CHANGES src/modules/standard mod_log_config.c Log: Added three log methods: CLF compliant '-' byte count, method and protocol. Revision Changes Path 1.1435 +8 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /x3/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1434 retrieving revision 1.1435 diff -u -r1.1434 -r1.1435 --- CHANGES 1999/09/23 18:51:41 1.1434 +++ CHANGES 1999/09/27 20:38:32 1.1435 @@ -1,5 +1,13 @@ Changes with Apache 1.3.10 + *) Added a CLF '-' respecting %B to the log format. + Suggested by Ragnar Kjørstad [dirkx] + + *) Added protocol(%m)/method(%H) logging to the log format. + Suggested by Peter W <[EMAIL PROTECTED]> [dirkx] + + *) Added a HEAD method to 'ab'. [dirkx] + *) When generating the Location: header, mod_speling forgot to escape the spelling-fixed uri. [Martin Kraemer] 1.79 +37 -3 apache-1.3/src/modules/standard/mod_log_config.c Index: mod_log_config.c =================================================================== RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- mod_log_config.c 1999/06/22 00:51:35 1.78 +++ mod_log_config.c 1999/09/27 20:38:46 1.79 @@ -117,7 +117,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'. * %...{FOOBAR}e: The contents of the environment variable FOOBAR * %...f: filename * %...h: remote host @@ -141,6 +143,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 @@ -334,12 +338,20 @@ { 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 "-"; @@ -351,6 +363,19 @@ } } +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 ap_psprintf(r->pool, "%ld", bs); + } +} + + static const char *log_header_in(request_rec *r, char *a) { return ap_table_get(r->headers_in, a); @@ -480,9 +505,12 @@ '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 }, { @@ -505,6 +533,12 @@ }, { 'P', log_child_pid, 0 + }, + { + 'H', log_request_protocol, 0 + }, + { + 'm', log_request_method, 0 }, { '\0'