comparison src/http/modules/ngx_http_log_module.c @ 690:b5b7eea22fda NGINX_1_3_8

nginx 1.3.8 *) Feature: the "optional_no_ca" parameter of the "ssl_verify_client" directive. Thanks to Mike Kazantsev and Eric O'Connor. *) Feature: the $bytes_sent, $connection, and $connection_requests variables can now be used not only in the "log_format" directive. Thanks to Benjamin Grössing. *) Feature: the "auto" parameter of the "worker_processes" directive. *) Bugfix: "cache file ... has md5 collision" alert. *) Bugfix: in the ngx_http_gunzip_filter_module. *) Bugfix: in the "ssl_stapling" directive.
author Igor Sysoev <http://sysoev.ru>
date Tue, 30 Oct 2012 00:00:00 +0400
parents 5cb5db9975ba
children 88a1b4797f2e
comparison
equal deleted inserted replaced
689:4d942f0d1703 690:b5b7eea22fda
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 },
207 ngx_http_log_request_time }, 200 ngx_http_log_request_time },
208 { ngx_string("status"), NGX_INT_T_LEN, ngx_http_log_status }, 201 { ngx_string("status"), NGX_INT_T_LEN, ngx_http_log_status },
209 { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent }, 202 { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent },
210 { ngx_string("body_bytes_sent"), NGX_OFF_T_LEN, 203 { ngx_string("body_bytes_sent"), NGX_OFF_T_LEN,
211 ngx_http_log_body_bytes_sent }, 204 ngx_http_log_body_bytes_sent },
212 { ngx_string("apache_bytes_sent"), NGX_OFF_T_LEN,
213 ngx_http_log_body_bytes_sent },
214 { ngx_string("request_length"), NGX_SIZE_T_LEN, 205 { ngx_string("request_length"), NGX_SIZE_T_LEN,
215 ngx_http_log_request_length }, 206 ngx_http_log_request_length },
216 207
217 { ngx_null_string, 0, NULL } 208 { ngx_null_string, 0, NULL }
218 }; 209 };
496 static u_char * 487 static u_char *
497 ngx_http_log_copy_long(ngx_http_request_t *r, u_char *buf, 488 ngx_http_log_copy_long(ngx_http_request_t *r, u_char *buf,
498 ngx_http_log_op_t *op) 489 ngx_http_log_op_t *op)
499 { 490 {
500 return ngx_cpymem(buf, (u_char *) op->data, op->len); 491 return ngx_cpymem(buf, (u_char *) op->data, op->len);
501 }
502
503
504 static u_char *
505 ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
506 ngx_http_log_op_t *op)
507 {
508 return ngx_sprintf(buf, "%uA", r->connection->number);
509 }
510
511
512 static u_char *
513 ngx_http_log_connection_requests(ngx_http_request_t *r, u_char *buf,
514 ngx_http_log_op_t *op)
515 {
516 return ngx_sprintf(buf, "%ui", r->connection->requests);
517 } 492 }
518 493
519 494
520 static u_char * 495 static u_char *
521 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)
1141 1116
1142 if (var.len == 0) { 1117 if (var.len == 0) {
1143 goto invalid; 1118 goto invalid;
1144 } 1119 }
1145 1120
1146 if (ngx_strncmp(var.data, "apache_bytes_sent", 17) == 0) {
1147 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1148 "use \"$body_bytes_sent\" instead of "
1149 "\"$apache_bytes_sent\"");
1150 }
1151
1152 for (v = ngx_http_log_vars; v->name.len; v++) { 1121 for (v = ngx_http_log_vars; v->name.len; v++) {
1153 1122
1154 if (v->name.len == var.len 1123 if (v->name.len == var.len
1155 && ngx_strncmp(v->name.data, var.data, var.len) == 0) 1124 && ngx_strncmp(v->name.data, var.data, var.len) == 0)
1156 { 1125 {