dynamic logs

Igor Sysoev is at rambler-co.ru
Fri Sep 12 16:28:15 MSD 2008


On Fri, Sep 12, 2008 at 04:20:02PM +0400, Maxim Dounin wrote:

> Hello!
> 
> On Fri, Sep 12, 2008 at 03:41:03PM +0400, Maxim Dounin wrote:
> 
> >On Fri, Sep 12, 2008 at 11:10:02AM +0000, Vladan Popovic wrote:
> >
> >>Igor Sysoev <is at ...> writes:
> >>
> >>>
> >>>On Fri, Sep 12, 2008 at 07:38:42AM +0000, Vladan Popovic wrote:
> >>>
> >>>> Sorry for not being more knowledgeable ...
> >>>> I have init.d/nginx script to manage nginx.
> >>>> Should i run strace /etc/init.d/nginx restart or should i run 
> >>>another > instruction?
> >>>> (i did 'strace /etc/init.d/nginx' but couldn't find the string you 
> >>>are > looking for)
> >>>
> >>>Try the following:
> >>>
> >>>1) stop nginx via "/etc/init.d/nginx stop"
> >>>
> >>>2) add temporarily in nginx.conf:
> >>>
> >>>daemon          off;
> >>>master_process  off;
> >>>
> >>>This will force nginx to run single process only.
> >>>
> >>>3) then run nginx directly under strace:
> >>>
> >>>strace /usr/sbin/nginx
> >>>
> >>>4) and make request.
> >>>
> >>OK - i think i managed to do it ... here's the extract:
> >>
> >>open("/var/log/nginx/be-o.com", O_RDWR|O_CREAT|O_APPEND, 0644) = 14
> >>fstat(14, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
> >>fcntl(14, F_GETFL)                      = 0x8402 (flags  
> >>O_RDWR|O_APPEND|O_LARGEFILE)
> >>fcntl(14, F_SETFL, O_RDWR|O_APPEND|O_DIRECT|O_LARGEFILE) = 0
> >>write(14, "192.168.1.16 - - [12/Sep/2008:19"..., 196) = -1 EINVAL 
> >>(Invalid argument)
> >
> >Could you please check if 'directio off;' helps?  It should.
> 
> I was wrong, it shouldn't help.  Try the patch instead.

Yes, the patch will help only. However, I prefer different one.


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/modules/ngx_http_log_module.c
===================================================================
--- src/http/modules/ngx_http_log_module.c	(revision 1563)
+++ src/http/modules/ngx_http_log_module.c	(working copy)
@@ -430,6 +430,7 @@
     of.log = 1;
     of.valid = llcf->open_file_cache_valid;
     of.min_uses = llcf->open_file_cache_min_uses;
+    of.directio = NGX_MAX_OFF_T_VALUE;
 
     if (ngx_open_cached_file(llcf->open_file_cache, &log, &of, r->pool)
         != NGX_OK)


More information about the nginx mailing list