comparison 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
comparison
equal deleted inserted replaced
125:97504de1f89e 126:df17fbafec8f
53 ngx_http_log_op_t *op); 53 ngx_http_log_op_t *op);
54 static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf, 54 static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf,
55 ngx_http_log_op_t *op); 55 ngx_http_log_op_t *op);
56 static u_char *ngx_http_log_bytes_sent(ngx_http_request_t *r, u_char *buf, 56 static u_char *ngx_http_log_bytes_sent(ngx_http_request_t *r, u_char *buf,
57 ngx_http_log_op_t *op); 57 ngx_http_log_op_t *op);
58 static u_char *ngx_http_log_apache_bytes_sent(ngx_http_request_t *r, 58 static u_char *ngx_http_log_body_bytes_sent(ngx_http_request_t *r,
59 u_char *buf, ngx_http_log_op_t *op); 59 u_char *buf, ngx_http_log_op_t *op);
60 static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf, 60 static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
61 ngx_http_log_op_t *op); 61 ngx_http_log_op_t *op);
62 62
63 static size_t ngx_http_log_request_getlen(ngx_http_request_t *r, 63 static size_t ngx_http_log_request_getlen(ngx_http_request_t *r,
171 static ngx_str_t http_access_log = ngx_string(NGX_HTTP_LOG_PATH); 171 static ngx_str_t http_access_log = ngx_string(NGX_HTTP_LOG_PATH);
172 172
173 173
174 static ngx_str_t ngx_http_combined_fmt = 174 static ngx_str_t ngx_http_combined_fmt =
175 ngx_string("$remote_addr - $remote_user [$time_gmt] " 175 ngx_string("$remote_addr - $remote_user [$time_gmt] "
176 "\"$request\" $status $apache_bytes_sent " 176 "\"$request\" $status $body_bytes_sent "
177 "\"$http_referer\" \"$http_user_agent\""); 177 "\"$http_referer\" \"$http_user_agent\"");
178 178
179 179
180 static ngx_http_log_var_t ngx_http_log_vars[] = { 180 static ngx_http_log_var_t ngx_http_log_vars[] = {
181 { ngx_string("connection"), NGX_ATOMIC_T_LEN, ngx_http_log_connection }, 181 { ngx_string("connection"), NGX_ATOMIC_T_LEN, ngx_http_log_connection },
184 ngx_http_log_time }, 184 ngx_http_log_time },
185 { ngx_string("msec"), NGX_TIME_T_LEN + 4, ngx_http_log_msec }, 185 { ngx_string("msec"), NGX_TIME_T_LEN + 4, ngx_http_log_msec },
186 { ngx_string("request_time"), NGX_TIME_T_LEN, ngx_http_log_request_time }, 186 { ngx_string("request_time"), NGX_TIME_T_LEN, ngx_http_log_request_time },
187 { ngx_string("status"), 3, ngx_http_log_status }, 187 { ngx_string("status"), 3, ngx_http_log_status },
188 { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent }, 188 { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent },
189 { ngx_string("body_bytes_sent"), NGX_OFF_T_LEN,
190 ngx_http_log_body_bytes_sent },
189 { ngx_string("apache_bytes_sent"), NGX_OFF_T_LEN, 191 { ngx_string("apache_bytes_sent"), NGX_OFF_T_LEN,
190 ngx_http_log_apache_bytes_sent }, 192 ngx_http_log_body_bytes_sent },
191 { ngx_string("request_length"), NGX_SIZE_T_LEN, 193 { ngx_string("request_length"), NGX_SIZE_T_LEN,
192 ngx_http_log_request_length }, 194 ngx_http_log_request_length },
193 195
194 { ngx_null_string, 0, NULL } 196 { ngx_null_string, 0, NULL }
195 }; 197 };
207 ngx_http_log_request_time }, 209 ngx_http_log_request_time },
208 { ngx_string("status"), 3, NULL, NULL, ngx_http_log_status }, 210 { ngx_string("status"), 3, NULL, NULL, ngx_http_log_status },
209 { ngx_string("length"), NGX_OFF_T_LEN, 211 { ngx_string("length"), NGX_OFF_T_LEN,
210 NULL, NULL, ngx_http_log_bytes_sent }, 212 NULL, NULL, ngx_http_log_bytes_sent },
211 { ngx_string("apache_length"), NGX_OFF_T_LEN, 213 { ngx_string("apache_length"), NGX_OFF_T_LEN,
212 NULL, NULL, ngx_http_log_apache_bytes_sent }, 214 NULL, NULL, ngx_http_log_body_bytes_sent },
213 { ngx_string("request_length"), NGX_SIZE_T_LEN, 215 { ngx_string("request_length"), NGX_SIZE_T_LEN,
214 NULL, NULL, ngx_http_log_request_length }, 216 NULL, NULL, ngx_http_log_request_length },
215 217
216 { ngx_string("request"), 0, NULL, 218 { ngx_string("request"), 0, NULL,
217 ngx_http_log_request_getlen, 219 ngx_http_log_request_getlen,
427 return ngx_sprintf(buf, "%O", r->connection->sent); 429 return ngx_sprintf(buf, "%O", r->connection->sent);
428 } 430 }
429 431
430 432
431 static u_char * 433 static u_char *
432 ngx_http_log_apache_bytes_sent(ngx_http_request_t *r, u_char *buf, 434 ngx_http_log_body_bytes_sent(ngx_http_request_t *r, u_char *buf,
433 ngx_http_log_op_t *op) 435 ngx_http_log_op_t *op)
434 { 436 {
435 off_t length; 437 off_t length;
436 438
437 length = r->connection->sent - r->header_size; 439 length = r->connection->sent - r->header_size;
809 811
810 return buf + 1; 812 return buf + 1;
811 } 813 }
812 814
813 815
814 static ngx_int_t 816 static ngx_int_t
815 ngx_http_log_variable_compile(ngx_conf_t *cf, ngx_http_log_op_t *op, 817 ngx_http_log_variable_compile(ngx_conf_t *cf, ngx_http_log_op_t *op,
816 ngx_str_t *value) 818 ngx_str_t *value)
817 { 819 {
818 ngx_int_t index; 820 ngx_int_t index;
819 821
1218 } 1220 }
1219 1221
1220 if (arg_len == 0) { 1222 if (arg_len == 0) {
1221 fname[fname_len] = '\0'; 1223 fname[fname_len] = '\0';
1222 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1224 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1223 "\"%s\" requires argument", 1225 "\"%s\" requires argument",
1224 data); 1226 data);
1225 return NGX_CONF_ERROR; 1227 return NGX_CONF_ERROR;
1226 } 1228 }
1227 1229
1228 a = ngx_palloc(cf->pool, sizeof(ngx_str_t)); 1230 a = ngx_palloc(cf->pool, sizeof(ngx_str_t));
1296 1298
1297 if (var.len == 0) { 1299 if (var.len == 0) {
1298 goto invalid; 1300 goto invalid;
1299 } 1301 }
1300 1302
1303 if (ngx_strncmp(var.data, "apache_bytes_sent", 17) == 0) {
1304 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1305 "use \"$body_bytes_sent\" instead of "
1306 "\"$apache_bytes_sent\"");
1307 }
1308
1301 for (v = ngx_http_log_vars; v->name.len; v++) { 1309 for (v = ngx_http_log_vars; v->name.len; v++) {
1302 1310
1303 if (v->name.len == var.len 1311 if (v->name.len == var.len
1304 && ngx_strncmp(v->name.data, var.data, var.len) == 0) 1312 && ngx_strncmp(v->name.data, var.data, var.len) == 0)
1305 { 1313 {