Simple command to reset / clear all logs?

Robert Bonomi bonomi at
Fri Jan 14 01:54:27 UTC 2011

> Date: Thu, 13 Jan 2011 18:31:21 -0600
> Subject: Re: Simple command to reset / clear all logs?
> To: questions at
> On Thu, Jan 13, 2011 at 6:28 PM, Robert Bonomi 
> <bonomi at>wrote:
> > > From: Adam Vande More <amvandemore at>
> > >
> > > 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."
> >
> Wrong, read what I said again.

I *did* read what you said.

To be blunt, you are full of sh*t as regards any file used by the standard
Berkeley syslog daemon, (syslogd).  The Berkeley syslogd is the standard
system log daemon on FreeBSD, although somme people do replace it with

>                                 The appropriate service recreates the log 
> file. 

_IF_ a service, e.g, apache logs _directly_ to it's own logfiles, this _may_
be true  It is explicitly *NOT*TRUE* for log files used by the standard
(Berkeley-based) syslogd daemon.  The FreeBSD manpage for syslogd, quoted
above, confirms that you do -not- know what you're talking about.

>        Any basic system log would be covered by this.

"Male Bovine Excretement" applies.

>                                                        Try it and see.

I've got over 25 years experience as a professional system/network admin,
all on BSD-derived systems. I can't tell you _how_many_ times I've been
called in to fix a 'failure to log' problem that was due to the logfile
simply -not- being present, even afer a reboot.

Now I'm not infallable, so I cheked the reference documentation _before_
posting,  The standard FreeBSD syslogd is -documented- as _NOT_CREATING_ 
the logfiles it uses, *UNLESS* the '-C' option is specified upon program 

Since a logging service cannot tell whether the system is in single-user
or multi-user mode, you can verify this syslogd behaviour by simply deleting
one of the common log files -- say /var/log/messages -- then killing the
running syslogd, and re-starting it.  As you say "Try it and see".

Those of you who think you know it all are very annoying to those of us 
who do.

More information about the freebsd-questions mailing list