Simple command to reset / clear all logs?

Robert Bonomi bonomi at mail.r-bonomi.com
Fri Jan 14 00:22:59 UTC 2011


> From owner-freebsd-questions at freebsd.org  Thu Jan 13 01:26:33 2011
> Date: Thu, 13 Jan 2011 01:20:14 -0600
> From: Adam Vande More <amvandemore at gmail.com>
> To: Redd Vinylene <reddvinylene at gmail.com>
> Cc: questions <questions at freebsd.org>, Bernt Hansson <bernt at bah.homeip.net>
> Subject: Re: Simple command to reset / clear all logs?
>
> On Wed, Jan 12, 2011 at 1:50 PM, Redd Vinylene 
> <reddvinylene at gmail.com>wrote:
>
> > Will the logs automatically create themselves? I mean, I picture I have 
> > to manually touch a lotta them in order to avoid "cannot find" error 
> > messages?
> >
>
> Please don't top post.
>
> do something like this:
>
> shutdown now rm /var/log/* exit
>
> upon reentering multiuser mode, each logging service will create it's new 
> file.

FALSE TO FACT, with regard to any/all files that syslogd(8) uses,
_unless_ syslogd is invoked with the '-C' option.  

Quoting from the manpage:
    "For security reasons, syslogd will not append to log files that do not
     exist (unless -C option is specified); therefore, they must be created
     manually before running syslogd."


>        Typically if a service is running and you delete the log from it, 
> the service will not like it.  You can HUP the service to have it restart 
> logging, but you'd have to do it manually for each log you deleted.
>


More information about the freebsd-questions mailing list