Simple command to reset / clear all logs?

Polytropon freebsd at edvax.de
Wed Jan 12 19:21:48 UTC 2011


On Thu, 13 Jan 2011 02:17:10 +0900, Ryuichiro Hara <rhml at 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/*

This will affect ALL files (expansion of *) which may not
be precise enough in case you want to keep some of the
log files.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list