FYI - this is not related to namespaces, logto2 + log-maxsize doesn't work properly in any case. When uWSGI starts it write to file descriptor 2, it's always the log file. But after privilages drop when logto2 takes over it writes to file descriptor 3, since this is the value of uwsgi.original_log_fd. Parts of code uses hardcoded fd=2, parts are using original_log_fd. I think that original_log_fd should only be used if log-master is enabled, but I'm not sure yet. This leads to strange bugs like lseek errors in uwsgi_check_logrotate() - it will return illegal seek error every time, I thinks this is happening since it tries to seek on fd=2 with SEEK_CUR of fd=3 (from original_log_fd, it's my rotated log fd). Seek error is ignored (lseek returns <0) so when it's casted to unsigned long long uwsgi_check_logrotate() thinks that my log is extremely big, while it's still 0 bytes long. I'm gonna need some time to figure it out.
2014-04-05 19:43 GMT+02:00 Łukasz Mierzwa <[email protected]>: > FYI I'm done for today, but I'll try to debug it tomorrow (--namespace + > --logto2 + --log-maxsize combination). > > > 2014-04-05 18:07 GMT+02:00 Łukasz Mierzwa <[email protected]>: > > I don't think this is the case, I do have log-backupname set and new log >> file was created. >> >> >> 2014-04-05 18:03 GMT+02:00 Łukasz Mierzwa <[email protected]>: >> >> So I shall write one ;P >>> >>> >>> 2014-04-05 17:53 GMT+02:00 Roberto De Ioris <[email protected]>: >>> >>> >>>> > Hi, >>>> > >>>> > I'm not sure if this is bug with logging or I simply failed to find >>>> the >>>> > right combination of options. Right now I'm pushing logs from vassals >>>> > using >>>> > remote syslog plugin (localhost syslog over tcp), it works just fine. >>>> I >>>> > wanted to switch to plain log files, each vassal would have rotated >>>> log >>>> > file inside the namespace. >>>> > >>>> > If I use --logto I must pass full path including namespace path, >>>> example: >>>> > --logto=/ns/app1/home/uwsgi.log >>>> > so I guess that logs are opened before jailing vassal. >>>> > >>>> > If I'll add --log-maxsize it doesn't work regardless if I set full >>>> path, >>>> > or >>>> > just path inside the namespace. I think that uWSGI tries to call >>>> rename() >>>> > using full path as first arg, but we are inside the namespace so it >>>> fails. >>>> > >>>> > So i tried using --logto2 - it would open logfile after dropping >>>> > privileges, so it will happen inside my namespace. This works just >>>> fine. >>>> > >>>> > So I've added --log-maxsize again, log is being rotated, but all >>>> writes >>>> > are >>>> > still going to rotated log, looks like it's not being reopened after >>>> > rotating. I've checked with lsof and it turns out that master process >>>> has >>>> > new file opened, but all workers keep old file opened. >>>> > I've tried adding --log-master, but it doesn't seem to have any >>>> effect. >>>> > >>>> > Am I missing something with this setup? >>>> > >>>> >>>> --logto2 seems the right approach to me, but the problem is here: >>>> >>>> https://github.com/unbit/uwsgi/blob/master/core/logging.c#L520 >>>> >>>> the filename checked is the one from --logto >>>> >>>> it should be an easy fix, i will wait for your patch ;) >>>> >>>> >>>> >>>> -- >>>> Roberto De Ioris >>>> http://unbit.it >>>> _______________________________________________ >>>> uWSGI mailing list >>>> [email protected] >>>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi >>>> >>> >>> >>> >>> -- >>> Łukasz Mierzwa >>> >> >> >> >> -- >> Łukasz Mierzwa >> > > > > -- > Łukasz Mierzwa > -- Łukasz Mierzwa
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
