Confusing between newsyslog and logrotate

Hello all:
I am confusing FreeBSD already has newsyslog untility but the port also has other called logrotate and I am confusing between these two commmand then.
Does any one can describe the diff?

Thx.:P
 
syslog & logrotate: Not the same animal

Logrotate and syslog, syslogng, syslogd are totally independent from each other... Logrotate is run [usually as cron jobs] to keep your various log files from eating up your entire hard disk.

syslog, syslogng, and syslogd are the actual logging daemons that create the various log files [take a look in /var/log] -- you should see a couple dozen system log files...

[CMD=""]%> ls -lh /var/log[/CMD]

You definitely want to run logrotate on some regular schedules as the '/var' mount [partition] is not usually very large [mine is only 3G on a 500G disk]. I experienced a situation about 7 years ago [when I first started with FreeBSD] where I let the system log files in '/var/log' exceeded the space on that mount -- Believe me: you don't want to let this happen ! (This was how I learned about the importance of log rotation)

You are way better off having logrotate auto-schrunch your log files up and dispose of the trash for you than doing it manually.

I'd like to introduce you to 'man...

[CMD=""]%> man syslog[/CMD]

The syslog() function writes message to the system message logger. The
message is then written to the system console, log files, logged-in
users, or forwarded to other machines as appropriate. (See syslogd(8).)

The message is identical to a printf(3) format string, except that `%m'
is replaced by the current error message. (As denoted by the global
variable errno; see strerror(3).) A trailing newline is added if none is
present.

The vsyslog() function is an alternate form in which the arguments have
already been captured using the variable-length argument facilities of
stdarg(3).

[CMD=""]%> man logrotate[/CMD]

logrotate is designed to ease administration of systems that generate
large numbers of log files. It allows automatic rotation, compression,
removal, and mailing of log files. Each log file may be handled daily,
weekly, monthly, or when it grows too large.

Normally, logrotate is run as a daily cron job. It will not modify a
log multiple times in one day unless the criterium for that log is
based on the log's size and logrotate is being run multiple times each
day, or unless the -f or -force option is used.

Any number of config files may be given on the command line. Later con-
fig files may override the options given in earlier files, so the order
in which the logrotate config files are listed is important. Normally,
a single config file which includes any other config files which are
needed should be used. See below for more information on how to use
the include directive to accomplish this. If a directory is given on
the command line, every file in that directory is used as a config
file.

If no command line arguments are given, logrotate will print version
and copyright information, along with a short usage summary. If any
errors occur while rotating logs, logrotate will exit with non-zero
status.
 
newsyslog and logrotate are mostly identical.
From logrotate/pkg-descr:
I try to make it work just like /usr/sbin/newsyslog.
With logrotate, you can mail syslog and execute command
before or after logrotate.
 
Back
Top