How to Use the Operating System Services to Trim Log Files

You can use the Solaris operating environment services to automatically manage the size of the Backup log files.
Solaris software provides a two-part mechanism for managing the
syslogmessage file (/var/log/syslog): a shell script (/usr/lib/newsyslog) and a crontab entry for rootto periodically invoke the script.
You can modify the
newsyslogscript to manage and maintain a short history of the Backup server's log file. The modified script maintains a three-file history of the Backup server's daemon.logfile.
To manage your Backup log file, follow these steps:

1.Use your favorite text editor to add the following lines to

LOGDIR=/nsr/logs
LOG=daemon.log
if test -d $LOGDIR
then
cd $LOGDIR
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
test -f $LOG&& mv $LOG$LOG.0
cp /dev/null $LOG
chmod 644 $LOG
fi

/usr/lib/newsyslog:

Backup cannot use the new log file until you shut down and restart the Backup daemons. Shut down the daemons with the nsr_shutdowncommand, either manually or as an additional command in the newsyslogscript. Make sure that the script does not run during a scheduled save. Then, restart Backup manually using the following commands:

IMAGE imgs/admin.book11.gif
# /etc/init.d/networker start
IMAGE imgs/admin.book11.gif

Chapter 3

Server and Storage Node Operations

53