comparison src/http/modules/ngx_http_log_module.c @ 298:30862655219e NGINX_0_5_19

nginx 0.5.19 *) Change: now the $request_time variable has millisecond precision. *) Change: the method $r->rflush of ngx_http_perl_module was renamed to the $r->flush. *) Feature: the $upstream_addr variable. *) Feature: the "proxy_headers_hash_max_size" and "proxy_headers_hash_bucket_size" directives. Thanks to Volodymyr Kostyrko. *) Bugfix: the files more than 2G could not be transferred using sendfile and limit_rate on 64-bit platforms. *) Bugfix: the files more than 2G could not be transferred using sendfile on 64-bit Linux.
author Igor Sysoev <http://sysoev.ru>
date Tue, 24 Apr 2007 00:00:00 +0400
parents 2ceaee987f37
children 7cf404023f50
comparison
equal deleted inserted replaced
297:df0fd0d43ed8 298:30862655219e
168 { ngx_string("connection"), NGX_ATOMIC_T_LEN, ngx_http_log_connection }, 168 { ngx_string("connection"), NGX_ATOMIC_T_LEN, ngx_http_log_connection },
169 { ngx_string("pipe"), 1, ngx_http_log_pipe }, 169 { ngx_string("pipe"), 1, ngx_http_log_pipe },
170 { ngx_string("time_local"), sizeof("28/Sep/1970:12:00:00 +0600") - 1, 170 { ngx_string("time_local"), sizeof("28/Sep/1970:12:00:00 +0600") - 1,
171 ngx_http_log_time }, 171 ngx_http_log_time },
172 { ngx_string("msec"), NGX_TIME_T_LEN + 4, ngx_http_log_msec }, 172 { ngx_string("msec"), NGX_TIME_T_LEN + 4, ngx_http_log_msec },
173 { ngx_string("request_time"), NGX_TIME_T_LEN, ngx_http_log_request_time }, 173 { ngx_string("request_time"), NGX_TIME_T_LEN + 4,
174 ngx_http_log_request_time },
174 { ngx_string("status"), 3, ngx_http_log_status }, 175 { ngx_string("status"), 3, ngx_http_log_status },
175 { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent }, 176 { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent },
176 { ngx_string("body_bytes_sent"), NGX_OFF_T_LEN, 177 { ngx_string("body_bytes_sent"), NGX_OFF_T_LEN,
177 ngx_http_log_body_bytes_sent }, 178 ngx_http_log_body_bytes_sent },
178 { ngx_string("apache_bytes_sent"), NGX_OFF_T_LEN, 179 { ngx_string("apache_bytes_sent"), NGX_OFF_T_LEN,
392 393
393 static u_char * 394 static u_char *
394 ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf, 395 ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf,
395 ngx_http_log_op_t *op) 396 ngx_http_log_op_t *op)
396 { 397 {
397 time_t elapsed; 398 ngx_time_t *tp;
398 399 ngx_msec_int_t ms;
399 elapsed = ngx_time() - r->start_time; 400
400 401 tp = ngx_timeofday();
401 return ngx_sprintf(buf, "%T", elapsed); 402
403 ms = (tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec);
404 ms = (ms >= 0) ? ms : 0;
405
406 return ngx_sprintf(buf, "%T.%03M", ms / 1000, ms % 1000);
402 } 407 }
403 408
404 409
405 static u_char * 410 static u_char *
406 ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op) 411 ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)