diff src/http/modules/ngx_http_log_module.c @ 126:df17fbafec8f NGINX_0_3_10

nginx 0.3.10 *) Change: the "valid_referers" directive and the "$invalid_referer" variable were moved to the new ngx_http_referer_module from the ngx_http_rewrite_module. *) Change: the "$apache_bytes_sent" variable name was changed to "$body_bytes_sent". *) Feature: the "$sent_http_..." variables. *) Feature: the "if" directive supports the "=" and "!=" operations. *) Feature: the "proxy_pass" directive supports the HTTPS protocol. *) Feature: the "proxy_set_body" directive. *) Feature: the "post_action" directive. *) Feature: the ngx_http_empty_gif_module. *) Feature: the "worker_cpu_affinity" directive for Linux. *) Bugfix: the "rewrite" directive did not unescape URI part in redirect, now it is unescaped except the %00-%25 and %7F-%FF characters. *) Bugfix: nginx could not be built by the icc 9.0 compiler. *) Bugfix: if the SSI was enabled for zero size static file, then the chunked response was encoded incorrectly.
author Igor Sysoev <http://sysoev.ru>
date Tue, 15 Nov 2005 00:00:00 +0300
parents d25a1d6034f1
children 82d695e3d662
line wrap: on
line diff
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -55,7 +55,7 @@ static u_char *ngx_http_log_status(ngx_h
     ngx_http_log_op_t *op);
 static u_char *ngx_http_log_bytes_sent(ngx_http_request_t *r, u_char *buf,
     ngx_http_log_op_t *op);
-static u_char *ngx_http_log_apache_bytes_sent(ngx_http_request_t *r,
+static u_char *ngx_http_log_body_bytes_sent(ngx_http_request_t *r,
     u_char *buf, ngx_http_log_op_t *op);
 static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
     ngx_http_log_op_t *op);
@@ -173,7 +173,7 @@ static ngx_str_t  http_access_log = ngx_
 
 static ngx_str_t  ngx_http_combined_fmt =
     ngx_string("$remote_addr - $remote_user [$time_gmt] "
-               "\"$request\" $status $apache_bytes_sent "
+               "\"$request\" $status $body_bytes_sent "
                "\"$http_referer\" \"$http_user_agent\"");
 
 
@@ -186,8 +186,10 @@ static ngx_http_log_var_t  ngx_http_log_
     { ngx_string("request_time"), NGX_TIME_T_LEN, ngx_http_log_request_time },
     { ngx_string("status"), 3, ngx_http_log_status },
     { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent },
+    { ngx_string("body_bytes_sent"), NGX_OFF_T_LEN,
+                          ngx_http_log_body_bytes_sent },
     { ngx_string("apache_bytes_sent"), NGX_OFF_T_LEN,
-                          ngx_http_log_apache_bytes_sent },
+                          ngx_http_log_body_bytes_sent },
     { ngx_string("request_length"), NGX_SIZE_T_LEN,
                           ngx_http_log_request_length },
 
@@ -209,7 +211,7 @@ ngx_http_log_op_name_t  ngx_http_log_fmt
     { ngx_string("length"), NGX_OFF_T_LEN,
                           NULL, NULL, ngx_http_log_bytes_sent },
     { ngx_string("apache_length"), NGX_OFF_T_LEN,
-                          NULL, NULL, ngx_http_log_apache_bytes_sent },
+                          NULL, NULL, ngx_http_log_body_bytes_sent },
     { ngx_string("request_length"), NGX_SIZE_T_LEN,
                           NULL, NULL, ngx_http_log_request_length },
 
@@ -429,7 +431,7 @@ ngx_http_log_bytes_sent(ngx_http_request
 
 
 static u_char *
-ngx_http_log_apache_bytes_sent(ngx_http_request_t *r, u_char *buf,
+ngx_http_log_body_bytes_sent(ngx_http_request_t *r, u_char *buf,
     ngx_http_log_op_t *op)
 {
     off_t  length;
@@ -811,7 +813,7 @@ ngx_http_log_transfer_encoding_header_ou
 }
 
 
-static ngx_int_t 
+static ngx_int_t
 ngx_http_log_variable_compile(ngx_conf_t *cf, ngx_http_log_op_t *op,
     ngx_str_t *value)
 {
@@ -1220,7 +1222,7 @@ ngx_http_log_compile_format(ngx_conf_t *
                         if (arg_len == 0) {
                             fname[fname_len] = '\0';
                             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                                               "\"%s\" requires argument", 
+                                               "\"%s\" requires argument",
                                                data);
                             return NGX_CONF_ERROR;
                         }
@@ -1298,6 +1300,12 @@ ngx_http_log_compile_format(ngx_conf_t *
                     goto invalid;
                 }
 
+                if (ngx_strncmp(var.data, "apache_bytes_sent", 17) == 0) {
+                    ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+                        "use \"$body_bytes_sent\" instead of "
+                        "\"$apache_bytes_sent\"");
+                }
+
                 for (v = ngx_http_log_vars; v->name.len; v++) {
 
                     if (v->name.len == var.len