[uWSGI] Namespaced vassals and log rotation

Roberto De Ioris roberto at unbit.it
Sat Apr 5 17:53:37 CEST 2014


> 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


More information about the uWSGI mailing list