Simple command to reset / clear all logs?

Tim Daneliuk tundra at
Thu Jan 13 20:54:58 UTC 2011

On 1/13/2011 2:56 PM, Robert Bonomi wrote:
>> Date: Wed, 12 Jan 2011 20:58:04 +0100
>> From: Polytropon <freebsd at>
>> Subject: Re: Simple command to reset / clear all logs?
>> On Wed, 12 Jan 2011 20:50:04 +0100, Redd Vinylene 
>> <reddvinylene at> wrote:
>>> Will the logs automatically create themselves?
>> Usually not, but it depends on the logging mechanism. If a program 
>> continuously re-opens the file (after closing it) in APPEND mode, it 
>> should be created if non-existent. But if the program keeps the file open 
>> and just writes to it, it can cause trouble. Good programs check the 
>> return code of the writing operation and signal an error. Bad programs 
>> don't do that, they just keep writing to nowhere. :-)
> _syslogd_ *explicitly* does -not- _create_ any log files.  it is documented
> in the manpages that it behaves that way.  Whether or not this is a "good 
> idea" is debatable, but it does allow you to suppress some logging w/o having
> to edit the syslog.conf file and/or re-start syslogd.
>>> I mean, I picture I have to manually touch a lotta them in order to 
>>> avoid "cannot find" error messages?
> Syslog does -not- give any such messages, it just doesn't write the message
> anywere.

It's worth noting that if you delete an open file, any programs with
open write handles to the file can still write to it and thus chew
up disk space.   So ... you can't just reach in and delete log files
unless you're sure nothing has them open.

Tim Daneliuk
tundra at

More information about the freebsd-questions mailing list