[asterisk-users] OT - log rotation [solved]

Steve Edwards asterisk.org at sedwards.com
Fri Sep 4 18:56:01 CDT 2009


> On 4/09/09 10:31 PM, Stanisław Pitucha wrote:
>> 2009/9/4 Olivier<oza-4h07 at myamail.com>:
>>>  From an off-list comment, I think the explanation is :
>>> - some apps are opening and closing log files before and after each writing,
>>> - some are leaving log files open.
>>>
>>> When a log file is currently rotated, both apps can't append anything
>>> anymore to log files.
>>
>> That's not correct (on a *nix system anyways). In the second case, if
>> some app holds a descriptor of an open file and you move the file
>> around in the same filesystem, nothing changes. You can rename 'log'
>> to 'log.1', but it doesn't change the descriptor and the application
>> will still write to the file (it's just named differently).
>> The logger restart just does a { close(); open(); } and you're logging
>> to a new 'log' again. This way you don't lose any messages during the
>> rotation.

On Sat, 5 Sep 2009, Matt Riddell wrote:

> I think the potential problem comes if log rotation creates a new file,
> compresses the old one to a .tar.gz file and then creates a new one - if
> Asterisk doesn't know about this, it will not be able to log to the new
> file.

If we're interested in "I thinks" :)

I think applications that create log files are a PITA -- so last century, 
so limiting.

Every application creating a different log file in a different format. 
Every application solving the same problems (i.e. file rotation) over and 
over again. Such a waste.

Syslog is ubiquitous, well documented, and offers flexibility beyond most 
applications.

Thank God Asterisk can be configured to use syslog. I think Asterisk 
should "deprecate" logging to files to "encourage" users to "get with best 
practices."

Not looking for a flame-fest, but why are you using application specific 
log files?

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000


More information about the asterisk-users mailing list