Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_log_module.c @ 633:f971949ffb58 release-0.3.38
nginx-0.3.38-RELEASE import
*) Feature: the ngx_http_dav_module.
*) Change: the ngx_http_perl_module optimizations.
Thanks to Sergey Skvortsov.
*) Feature: the ngx_http_perl_module supports the $r->request_body_file
method.
*) Feature: the "client_body_in_file_only" directive.
*) Workaround: now on disk overflow nginx tries to write access logs
once a second only.
Thanks to Anton Yuzhaninov and Maxim Dounin.
*) Bugfix: now the "limit_rate" directive more precisely limits rate if
rate is more than 100 Kbyte/s.
Thanks to ForJest.
*) Bugfix: now the IMAP/POP3 proxy escapes the "\r" and "\n" symbols in
login and password to pass authorization server.
Thanks to Maxim Dounin.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 14 Apr 2006 09:53:38 +0000 |
parents | 326634fb9d47 |
children | 4946078f0a79 |
comparison
equal
deleted
inserted
replaced
632:5c60f5f0887d | 633:f971949ffb58 |
---|---|
21 ngx_uint_t combined_used; /* unsigned combined_used:1 */ | 21 ngx_uint_t combined_used; /* unsigned combined_used:1 */ |
22 } ngx_http_log_main_conf_t; | 22 } ngx_http_log_main_conf_t; |
23 | 23 |
24 typedef struct { | 24 typedef struct { |
25 ngx_open_file_t *file; | 25 ngx_open_file_t *file; |
26 time_t disk_full_time; | |
26 ngx_array_t *ops; /* array of ngx_http_log_op_t */ | 27 ngx_array_t *ops; /* array of ngx_http_log_op_t */ |
27 } ngx_http_log_t; | 28 } ngx_http_log_t; |
28 | 29 |
29 typedef struct { | 30 typedef struct { |
30 ngx_array_t *logs; /* array of ngx_http_log_t */ | 31 ngx_array_t *logs; /* array of ngx_http_log_t */ |
251 } | 252 } |
252 | 253 |
253 log = lcf->logs->elts; | 254 log = lcf->logs->elts; |
254 for (l = 0; l < lcf->logs->nelts; l++) { | 255 for (l = 0; l < lcf->logs->nelts; l++) { |
255 | 256 |
257 if (ngx_time() == log[l].disk_full_time) { | |
258 | |
259 /* | |
260 * On FreeBSD writing to a full filesystem with enabled softupdates | |
261 * may block process for much longer time than writing to non-full | |
262 * filesystem, so we skip writing the log for one second. | |
263 */ | |
264 | |
265 continue; | |
266 } | |
267 | |
256 len = 0; | 268 len = 0; |
257 op = log[l].ops->elts; | 269 op = log[l].ops->elts; |
258 for (i = 0; i < log[l].ops->nelts; i++) { | 270 for (i = 0; i < log[l].ops->nelts; i++) { |
259 if (op[i].len == 0) { | 271 if (op[i].len == 0) { |
260 len += op[i].getlen(r, op[i].data); | 272 len += op[i].getlen(r, op[i].data); |
270 | 282 |
271 if (file->buffer) { | 283 if (file->buffer) { |
272 | 284 |
273 if (len > (size_t) (file->last - file->pos)) { | 285 if (len > (size_t) (file->last - file->pos)) { |
274 | 286 |
275 ngx_write_fd(file->fd, file->buffer, file->pos - file->buffer); | 287 if (ngx_write_fd(file->fd, file->buffer, |
288 file->pos - file->buffer) | |
289 == -1 | |
290 && ngx_errno == NGX_ENOSPC) | |
291 { | |
292 log[l].disk_full_time = ngx_time(); | |
293 } | |
276 | 294 |
277 file->pos = file->buffer; | 295 file->pos = file->buffer; |
278 } | 296 } |
279 | 297 |
280 if (len <= (size_t) (file->last - file->pos)) { | 298 if (len <= (size_t) (file->last - file->pos)) { |
304 p = op[i].run(r, p, &op[i]); | 322 p = op[i].run(r, p, &op[i]); |
305 } | 323 } |
306 | 324 |
307 ngx_linefeed(p); | 325 ngx_linefeed(p); |
308 | 326 |
309 ngx_write_fd(file->fd, line, p - line); | 327 if (ngx_write_fd(file->fd, line, p - line) == -1 |
328 && ngx_errno == NGX_ENOSPC) | |
329 { | |
330 log[l].disk_full_time = ngx_time(); | |
331 } | |
310 } | 332 } |
311 | 333 |
312 return NGX_OK; | 334 return NGX_OK; |
313 } | 335 } |
314 | 336 |
1014 | 1036 |
1015 log->file = ngx_conf_open_file(cf->cycle, &value[1]); | 1037 log->file = ngx_conf_open_file(cf->cycle, &value[1]); |
1016 if (log->file == NULL) { | 1038 if (log->file == NULL) { |
1017 return NGX_CONF_ERROR; | 1039 return NGX_CONF_ERROR; |
1018 } | 1040 } |
1041 | |
1042 log->disk_full_time = 0; | |
1019 | 1043 |
1020 if (cf->args->nelts >= 3) { | 1044 if (cf->args->nelts >= 3) { |
1021 name = value[2]; | 1045 name = value[2]; |
1022 | 1046 |
1023 if (ngx_strcmp(name.data, "combined") == 0) { | 1047 if (ngx_strcmp(name.data, "combined") == 0) { |