[Twisted-Python] Known bug with twistd log rotation
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Wed Jun 11 09:52:16 MDT 2014
On 03:05 pm, max at riehl.io wrote:
>Hi!
>
>I'm finding it difficult to get log rotation working cleanly with
>twistd (if dropping privileges through twistd, which we require).
>I went through all the docs and also found [1] very helpful, but the
>problem boils down to the fact that
>> Implications for Logfile Rotation
>>
>>Using the configuration described here, the LOGFILE will be created as
>>user "root" and group "root", but rotated as user UID and group GID.
>>If you want rotation to work as advertised it is necessary to put the
>>LOGFILE in a directory in which UID/GID has permissions to rename
>>files.
>
>and
>> def rotate(self):
>> """
>> Rotate the file and create a new one.
>>
>> If it's not possible to open new logfile, this will fail
>>silently,
>> and continue logging to old logfile.
>> """
>> if not (os.access(self.directory, os.W_OK) and
>>os.access(self.path, os.W_OK)):
>> return
>(twisted 14.0.0)
>
>will never work together. Even if the user twistd runs as is
>technically able to rename the log file (due to having write
>permissions on the directory), it will never try to since it can't
>write to the file.
>There is a workaround on a comment in [1] but that's a really
>unnecessary and hacky solution, IMHO.
>
>Is this a known bug?
Sounds like https://twistedmatrix.com/trac/ticket/5723
Jean-Paul
More information about the Twisted-Python
mailing list