aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_log_module.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2014-09-13 21:47:13 +0400
committerValentin Bartenev <vbart@nginx.com>2014-09-13 21:47:13 +0400
commit152d92b4b76303d7b2d64e76cadf6d466df48f7f (patch)
tree2351ad3476757ebf2ff72698cdbb0021b2a506a6 /src/http/modules/ngx_http_log_module.c
parent02ce6c415f07ea8d7fa6b59a17ee2f02e77ab66b (diff)
downloadnginx-152d92b4b76303d7b2d64e76cadf6d466df48f7f.tar.gz
nginx-152d92b4b76303d7b2d64e76cadf6d466df48f7f.zip
Access log: fixed the "if=" parameter with buffering (ticket #625).
It might not work if there were more than one "access_log" directives pointed to the same file and duplicate buffer parameters.
Diffstat (limited to 'src/http/modules/ngx_http_log_module.c')
-rw-r--r--src/http/modules/ngx_http_log_module.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c
index 89aa4f58e..cec77e749 100644
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -1136,7 +1136,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_int_t gzip;
ngx_uint_t i, n;
ngx_msec_t flush;
- ngx_str_t *value, name, s, filter;
+ ngx_str_t *value, name, s;
ngx_http_log_t *log;
ngx_syslog_peer_t *peer;
ngx_http_log_buf_t *buffer;
@@ -1257,7 +1257,6 @@ process_formats:
size = 0;
flush = 0;
gzip = 0;
- filter.len = 0;
for (i = 3; i < cf->args->nelts; i++) {
@@ -1325,8 +1324,25 @@ process_formats:
}
if (ngx_strncmp(value[i].data, "if=", 3) == 0) {
- filter.len = value[i].len - 3;
- filter.data = value[i].data + 3;
+ s.len = value[i].len - 3;
+ s.data = value[i].data + 3;
+
+ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
+
+ ccv.cf = cf;
+ ccv.value = &s;
+ ccv.complex_value = ngx_palloc(cf->pool,
+ sizeof(ngx_http_complex_value_t));
+ if (ccv.complex_value == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+
+ log->filter = ccv.complex_value;
+
continue;
}
@@ -1405,23 +1421,6 @@ process_formats:
log->file->data = buffer;
}
- if (filter.len) {
- log->filter = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
- if (log->filter == NULL) {
- return NGX_CONF_ERROR;
- }
-
- ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
-
- ccv.cf = cf;
- ccv.value = &filter;
- ccv.complex_value = log->filter;
-
- if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
- }
-
return NGX_CONF_OK;
}