newsyslog – config check

On FreeBSD the best way to rotate logs is using newsyslog. After you set up you want to try what would happen when log rotation occurs, this can be done with -n and -vv

-n = dry run
-vv = verbose

For example

newsyslog -n -vv
Processing /etc/newsyslog.conf
Found: /etc/newsyslog.conf.d/*
Found: /usr/local/etc/newsyslog.conf.d/*
Processing /etc/newsyslog.conf.d/apache-logs.conf
/var/log/all.log <7J>: does not exist, skipped.
/var/log/amd.log <7J>: does not exist, skipped.
/var/log/auth.log <7J>: --> will trim at Wed Jan 1 00:00:00 2020
/var/log/console.log <5J>: does not exist, skipped.
/var/log/cron <3J>: size (Kb): 3 [100] --> skipping
/var/log/daily.log <7J>: does not exist, skipped.
/var/log/debug.log <7J>: size (Kb): 1 [100] --> skipping
/var/log/init.log <3J>: does not exist, skipped.
/var/log/kerberos.log <7J>: does not exist, skipped.
/var/log/lpd-errs <7J>: size (Kb): 1 [100] --> skipping
/var/log/maillog <7J>: --> time is up
--> trimming log....
rm -f /var/log/maillog.7
rm -f /var/log/maillog.7.gz
rm -f /var/log/maillog.7.bz2
rm -f /var/log/maillog.7.xz
rm -f /var/log/maillog.6
rm -f /var/log/maillog.6.gz
rm -f /var/log/maillog.6.bz2
rm -f /var/log/maillog.6.xz
mv /var/log/maillog.5.bz2 /var/log/maillog.6.bz2
mv /var/log/maillog.4.bz2 /var/log/maillog.5.bz2
mv /var/log/maillog.3.bz2 /var/log/maillog.4.bz2
mv /var/log/maillog.2.bz2 /var/log/maillog.3.bz2
mv /var/log/maillog.1.bz2 /var/log/maillog.2.bz2
mv /var/log/maillog.0.bz2 /var/log/maillog.1.bz2
ln /var/log/maillog /var/log/maillog.0
touch /var/log/maillog.0 # Update mtime for 'when'-interval processing
chmod 640 /var/log/maillog.0
Start new log...
mktemp /var/log/maillog.zXXXXXX
chmod 640 /var/log/maillog.zXXXXXX
mv /var/log/maillog.zXXXXXX /var/log/maillog
/var/log/messages <5J>: --> will trim at Wed Jan 1 00:00:00 2020
/var/log/monthly.log <12J>: does not exist, skipped.
/var/log/pflog <3J>: does not exist, skipped.
/var/log/ppp.log <3J>: size (Kb): 1 [100] --> skipping
/var/log/devd.log <3J>: size (Kb): 1 [100] --> skipping
/var/log/security <10J>: size (Kb): 1 [100] --> skipping
/var/log/sendmail.st <10>: age (hr): 83 [168] --> skipping
/var/log/utx.log <3>: --> will trim at Fri Feb 1 05:00:00 2019
/var/log/weekly.log <5J>: does not exist, skipped.
/var/log/xferlog <7J>: size (Kb): 1 [100] --> skipping
/var/log/httpd-*.log <9J>: does not exist, skipped.
/var/log/httpd-ssl_request.log <9J>: size (Kb): 30094 [100000] --> skipping
Compress all rotated log file(s)...
bzip2 /var/log/maillog.0
chmod 640 /var/log/maillog.0.bz2

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.