Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Aug 2013 00:28:33 +0100
From:      Frank Leonhardt <frank2@fjl.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: Archiving a log file
Message-ID:  <51FEE3A1.4080301@fjl.co.uk>
In-Reply-To: <5DF8D376-34BF-4748-8371-C616E7FEC2A1@elde.net>
References:  <51FD8E19.90403@fjl.co.uk> <37485629-94BD-48EF-B7A7-9ED4C5B9A6E5@olivent.com> <51FE32D3.3000707@fjl.co.uk> <5DF8D376-34BF-4748-8371-C616E7FEC2A1@elde.net>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 04/08/2013 14:38, Terje Elde wrote:
> On 4. aug. 2013, at 12:54, Frank Leonhardt <frank2@fjl.co.uk> wrote:
>> The program writing the log is actually called flubnutz and it doesn't play nice with newsyslog, reopen handles on a signal or anything else
> Then you're out of luck for normal rotation. No matter if you rename the file, or even delete it, it'll keep writing to the same file (the moved file, not the same filename).
>
> I suppose your options are to either restart it to have it reopen the file, or if that's not desirable for whatever reason, look see if it'll play nice if you put a named pipe where the logfile is supposed to be. Then you can handle data as you'd like from the pipe.
>
> Terje
>
Thanks. The consensus seems to be that there is no way to do this other 
than "start from a different place". It'd be difficult for the kernel to 
trim a file from the start unless it was on a block boundary, so it's 
not implemented and explains the numerous work arounds for dealing with 
logs (fifo to log manager, signalling an application to reopen logs 
because file has changed and so on).

So I will carry on using my original bodge, happy in the knowledge that 
it may not be perfect, but there's no better method known to exist 
unless I want to implement a better truncate() in the kernel.

Regards, Frank.





Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?51FEE3A1.4080301>