dynamic logs

Maxim Dounin mdounin at mdounin.ru
Fri Sep 12 16:20:02 MSD 2008


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.

Maxim Dounin

>
> Also the following patch should help without switching off directio:
>
> --- a/src/core/ngx_open_file_cache.c
> +++ b/src/core/ngx_open_file_cache.c
> @@ -498,7 +498,7 @@ ngx_open_and_stat_file(u_char *name, ngx
>      } else {
>          of->fd = fd;
>
> -        if (of->directio <= ngx_file_size(&fi)) {
> +        if (!of->log && of->directio <= ngx_file_size(&fi)) {
>              if (ngx_directio(fd) == -1) {
>                  ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
>                                ngx_directio_n " \"%s\" failed", name);
>
>
>
> Maxim Dounin
>





More information about the nginx mailing list