Mercurial > hg > nginx
comparison src/http/modules/ngx_http_log_module.c @ 4893:e89bd9896fea
Variables $connection and $connection_requests.
Log module counterparts are removed as they aren't used often and
there is no need to preserve them for efficiency.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 29 Oct 2012 17:17:59 +0000 |
parents | 8f1ad536caf1 |
children | 7737f0d788c1 |
comparison
equal
deleted
inserted
replaced
4892:063ac68d89dc | 4893:e89bd9896fea |
---|---|
76 static void ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, | 76 static void ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, |
77 u_char *buf, size_t len); | 77 u_char *buf, size_t len); |
78 static ssize_t ngx_http_log_script_write(ngx_http_request_t *r, | 78 static ssize_t ngx_http_log_script_write(ngx_http_request_t *r, |
79 ngx_http_log_script_t *script, u_char **name, u_char *buf, size_t len); | 79 ngx_http_log_script_t *script, u_char **name, u_char *buf, size_t len); |
80 | 80 |
81 static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, | |
82 ngx_http_log_op_t *op); | |
83 static u_char *ngx_http_log_connection_requests(ngx_http_request_t *r, | |
84 u_char *buf, ngx_http_log_op_t *op); | |
85 static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, | 81 static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, |
86 ngx_http_log_op_t *op); | 82 ngx_http_log_op_t *op); |
87 static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf, | 83 static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf, |
88 ngx_http_log_op_t *op); | 84 ngx_http_log_op_t *op); |
89 static u_char *ngx_http_log_iso8601(ngx_http_request_t *r, u_char *buf, | 85 static u_char *ngx_http_log_iso8601(ngx_http_request_t *r, u_char *buf, |
192 "\"$request\" $status $body_bytes_sent " | 188 "\"$request\" $status $body_bytes_sent " |
193 "\"$http_referer\" \"$http_user_agent\""); | 189 "\"$http_referer\" \"$http_user_agent\""); |
194 | 190 |
195 | 191 |
196 static ngx_http_log_var_t ngx_http_log_vars[] = { | 192 static ngx_http_log_var_t ngx_http_log_vars[] = { |
197 { ngx_string("connection"), NGX_ATOMIC_T_LEN, ngx_http_log_connection }, | |
198 { ngx_string("connection_requests"), NGX_INT_T_LEN, | |
199 ngx_http_log_connection_requests }, | |
200 { ngx_string("pipe"), 1, ngx_http_log_pipe }, | 193 { ngx_string("pipe"), 1, ngx_http_log_pipe }, |
201 { ngx_string("time_local"), sizeof("28/Sep/1970:12:00:00 +0600") - 1, | 194 { ngx_string("time_local"), sizeof("28/Sep/1970:12:00:00 +0600") - 1, |
202 ngx_http_log_time }, | 195 ngx_http_log_time }, |
203 { ngx_string("time_iso8601"), sizeof("1970-09-28T12:00:00+06:00") - 1, | 196 { ngx_string("time_iso8601"), sizeof("1970-09-28T12:00:00+06:00") - 1, |
204 ngx_http_log_iso8601 }, | 197 ngx_http_log_iso8601 }, |
498 return ngx_cpymem(buf, (u_char *) op->data, op->len); | 491 return ngx_cpymem(buf, (u_char *) op->data, op->len); |
499 } | 492 } |
500 | 493 |
501 | 494 |
502 static u_char * | 495 static u_char * |
503 ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, | |
504 ngx_http_log_op_t *op) | |
505 { | |
506 return ngx_sprintf(buf, "%uA", r->connection->number); | |
507 } | |
508 | |
509 | |
510 static u_char * | |
511 ngx_http_log_connection_requests(ngx_http_request_t *r, u_char *buf, | |
512 ngx_http_log_op_t *op) | |
513 { | |
514 return ngx_sprintf(buf, "%ui", r->connection->requests); | |
515 } | |
516 | |
517 | |
518 static u_char * | |
519 ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op) | 496 ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op) |
520 { | 497 { |
521 if (r->pipeline) { | 498 if (r->pipeline) { |
522 *buf = 'p'; | 499 *buf = 'p'; |
523 } else { | 500 } else { |