Log rotation in Solaris 8

From: Robert K (unixrobert@yahoo.ca)
Date: Tue Feb 07 2006 - 13:33:22 EST


Hi Karl
  Thanks for your reply. It is working fine on our Solaris 8 server.
  This could be useful for some one running Solaris 8 and is for their info.
   
  Rao

Karl Vogel <vogelke@pobox.com> wrote:
>> On Wed, 1 Feb 2006 10:55:38 -0500 (EST),
>> Robert K said:

R> In Solaris 9 we rotate the logs or files using /etc/logadm.conf and
R> cron. What is the file or utility for the same in Solaris 8?

I have the Linux program "logrotate" running under Solaris.
Sources are here:

ftp://sunsite.unc.edu/pub/solaris/freeware/SOURCES/logrotate-3.7.1.tar.gz
ftp://sunsite.unc.edu/pub/solaris/freeware/SOURCES/popt-1.7.tar.gz

It handles pre- and post-rotate commands (like restarting syslogd if
need be), optional compression, and optional mail notification. Here's
part of the config file used by logrotate, which checks the logs nightly
and rotates them when they get over 50k:

/doc/logs/access_log {
size=50k
postrotate
/etc/init.d/httpd-setup stop
sleep 10
/etc/init.d/httpd-setup start
endscript
}

/doc/logs/error_log {
size=50k
postrotate
/etc/init.d/httpd-setup stop
sleep 10
/etc/init.d/httpd-setup start
endscript
}

To build:

a. unpack popt-1.7 into its own directory

b. cd popt-1.7
CC=gcc CFLAGS=-O ./configure --disable-nls
make install
make distclean

c. unpack logrotate-3.7.1 into its own directory

d. cd logrotate-3.7.1
make
make install
make clean

Cron entry:
5 5 * * * /usr/local/sbin/logrotate /usr/local/lib/logrotate.conf

logrotate.conf includes this:

# keep 8 iterations of backlogs
rotate 8
# send errors to root
errors root
# create new (empty) log files after rotating old ones
create
# keep log files compressed
compress
# Wait before restarting cron; we don't want to run this job again
# if the logfile wasn't compressed.
/var/cron/log {
size=100k
postrotate
/etc/init.d/cron stop
/bin/sleep 60
/etc/init.d/cron start
endscript
}

-- 
Karl Vogel I don't speak for the USAF or my company
vogelke at pobox dot com http://www.pobox.com/~vogelke
First get the facts straight, then you are free to
distort them at your leisure. --Mark Twain
		
---------------------------------
Find your next car at Yahoo! Canada Autos
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:38:52 EDT