From owner-freebsd-questions@FreeBSD.ORG Thu Jan 13 08:38:52 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D1141065672 for ; Thu, 13 Jan 2011 08:38:52 +0000 (UTC) (envelope-from demelier.david@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2CC568FC0A for ; Thu, 13 Jan 2011 08:38:51 +0000 (UTC) Received: by wyf19 with SMTP id 19so1471104wyf.13 for ; Thu, 13 Jan 2011 00:38:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=TpLpidBs+EHqNBLOleRzfTecvePeomsX3SNT4RD5w/0=; b=sSc5DiuEwfGZ2QHPggcjdEAiYHm/dtzphAbguPyXW7Z6o69FcJUGzeTmbr02wtf0Bs dpDsSrVTiDCUaID9xpTpprxYSs2oEZR538jnv56Jw6VVtneftJ/MH1NCa6LnJmBhPKCX 8sOzXmkT72mXCud3zCEKgViUreq1nv2T58SvY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=mwDi1aCp00mW7rgXjze9s7zp2qu3+SRiF9UEvh2Y64XJGBF0Sh76InGI8EBFtzjKHk F267eCokeZScp1eCU4CCSOCwq4NhywggyrTLVfGXFVe1jNAHnuEiGFHiHf4hXaiZ+fkD G0nOIGoW6Ls1AC5wrdWihBfqwr5FM1Ae077/M= Received: by 10.227.146.138 with SMTP id h10mr2018022wbv.189.1294907930964; Thu, 13 Jan 2011 00:38:50 -0800 (PST) Received: from Melon.malikania.fr (65.21.102-84.rev.gaoland.net [84.102.21.65]) by mx.google.com with ESMTPS id m10sm1176678wbc.4.2011.01.13.00.38.48 (version=SSLv3 cipher=RC4-MD5); Thu, 13 Jan 2011 00:38:49 -0800 (PST) Message-ID: <4D2EBA06.2030200@gmail.com> Date: Thu, 13 Jan 2011 09:38:30 +0100 From: David Demelier User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.13) Gecko/20110111 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4D2DE216.6040505@kibug.org> <20110112202145.515b24b3.freebsd@edvax.de> <20110113022304.GA2455@stainmore> In-Reply-To: <20110113022304.GA2455@stainmore> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Simple command to reset / clear all logs? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jan 2011 08:38:52 -0000 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 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