Simple command to reset / clear all logs?
freebsd at edvax.de
Fri Jan 14 03:03:12 UTC 2011
On Thu, 13 Jan 2011 20:11:03 -0600, Adam Vande More <amvandemore at gmail.com> wrote:
> Amusing, but you're the one full of shit. There's more things to automatic
> log file creation than are thought of in your imagination.
I think Robert is right at least in regards of SOME
programs that use syslogd for logging OR do the
logging stuff on their own.
I may mantion ftpd logging as an example. Many years ago,
I have learned that setting
ftp (...stuff...) ftpd -ll
in /etc/inetd.conf (the "ell ell" is important) and adding
to /etc/syslog.conf would cause ftpd to do extended
logging. You can imagine how surprised I was that
there was no log file at all. I had to manually
# touch /var/log/ftpd.log
in order to enable the logging mechanism. Simply deleting
the file won't cause ftpd to create it on its own, and
syslod also doesn't create it, if I remember correctly.
It's also worth mentioning that programs that handle
logging on their own may be brought into trouble if the
logfile suddenly disappears, depending on the access
mechanism for that file, either by "open/append, write,
close" or by "don't close, keep writing".
That being said, I think one can recommend resetting
or clearing methods for all logs not depending on
deleting and (maybe) re-creating the files. Instead
setting them to zero length should not harm syslogd
or any other process that logs to files.
The methods of "echo '' > $file" or even the more
verbose "cat /dev/zero > $file" have been mentioned
on list, with $file being a shell wildcard expression
or `find ...` for better control about what to work
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions