[CRIU] [PATCH] service: rotate log by SIGHUP
Pavel Emelyanov
xemul at parallels.com
Tue Feb 11 00:15:18 PST 2014
On 02/11/2014 12:11 PM, Vladimir Davydov wrote:
> On 02/11/2014 11:49 AM, Ruslan Kuprieiev wrote:
>> On 11.02.2014 11:28, Vladimir Davydov wrote:
>>> On 02/11/2014 11:11 AM, Ruslan Kuprieiev wrote:
>>>> Because we wan't service to work non-stop.
>>>> And, as far as I know, by just using logrotate we will need to restart
>>>> service.
>>> Not necessarily, you can specify what should be done after rotate
>>> (`postrotate'), e.g. send a signal to your service so that it could
>>> reopen the logfile. However, I guess that `copytruncate' would be enough
>>> in your case.
>>
>> But what if service will write something between the moment when
>> logrotate will copy log and the moment when it will send signal to
>> service?
>
> Oh, if your logs are so valuable that loosing a message or two once a
> day/week/month is a disaster, then logrotate is, of course, not an
> option for you, sorry.
>
> However, from what I see you have the same race in your implementation:
> what if somebody prints to log while you're renaming it (after
> log_fini(), but before log_init())? Errors will go to stderr, which
> should be closed for a daemon?
Guys, what race are you talking about? Daemon keeps log_fd open all the
time. It points either to one file or to another.
Thanks,
Pavel
More information about the CRIU
mailing list