Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2011 09:38:30 +0100
From:      David Demelier <demelier.david@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Simple command to reset / clear all logs?
Message-ID:  <4D2EBA06.2030200@gmail.com>
In-Reply-To: <20110113022304.GA2455@stainmore>
References:  <AANLkTimMvTxsdRXhxzXwjdTDzQ5U7m7kzVc0orGwxM5U@mail.gmail.com>	<4D2DE216.6040505@kibug.org>	<20110112202145.515b24b3.freebsd@edvax.de> <20110113022304.GA2455@stainmore>

next in thread | previous in thread | raw e-mail | index | archive | help
On 13/01/2011 03:23, Bob Hall wrote:
> On Wed, Jan 12, 2011 at 08:21:45PM +0100, Polytropon wrote:
>> On Thu, 13 Jan 2011 02:17:10 +0900, Ryuichiro Hara<rhml@kibug.org>  wrote:
>>> Hello,
>>>
>>> It might be all right to remove all "normal file" logs,
>>> though you may want to retain all subdirectories.
>>>
>>> find /var/log -type f -exec rm {} \;
>>>
>>> may do.
>>
>> Possible problem: Programs that log to files may be confused
>> that the file has disappeared. How about simply cutting the
>> files to zero length?
>>
>> 	# cat /dev/null>  /var/log/*
>
> or	# truncate -s 0 /var/log/*
>
> That will save you two keystrokes, and that's important! ;-)

But, there is sometime subdirectories in /var/log, it doesn't matter? 
And truncate can write on archived files ? such as :

markand@Melon ~ $ ls /var/log/messages*.bz2
/var/log/messages.0.bz2 /var/log/messages.1.bz2

Cheers,

-- 
David Demelier



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D2EBA06.2030200>