[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Solaris log files



On Sat, 20 Feb 1999, Todd Williams wrote:
> 
> I've always considered writing some tool that would allow you to manage
> and age all your log files from one config file.  Maybe the config file
> would be a table that lists the base logfile name, the interval at which
> it gets aged, the number of logs or amount of space to keep online before
> deleting them, etc.
> 
> Anybody know of any such program?  It might be too much work for
> too little gain.

I'm sure there are others but you might check out RedHat's logrotate.
You can get it from them in RPM or SRPM (source) or you can find it in
several places as a tar ball.  Here's one:

   ftp://gatekeeper.dec.com/pub/linux/redhat/code/logrotate/

It's GNU'ed and is quite flexible.  A quote from the man page:

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

And an example conf from the man page:

       # sample logrotate configuration file
       errors sysadmin@my.org
       compress

       /var/log/messages {
           rotate 5
           weekly
           postrotate
                                     /sbin/killall -HUP syslogd
           endscript
       }

       /var/log/httpd/access.log {
           rotate 5
           mail www@my.org
           errors www@my.org
           size=100k
           postrotate
                                     /sbin/killall -HUP httpd
           endscript
       }

       /var/log/news/* {
           monthly
           rotate 2
           errors newsadmin@my.org
           postrotate
                                     kill -HUP `cat /var/run/inn.pid`
           endscript
           nocompress
       }

I haven't tried compiling it for any of the other UNIX flavors I
administer but it does a nice job on my linux systems.

Cheers,
Vern
-- 
\ \   / __| _ \  \ |   Vern Hart
 \ \ /  _|    / .  |   vern@hart.com
  \_/  ___|_|_\_|\_|

 8:43pm up 90 day(s), 20:22, 18 users, load average: 0.10, 0.13, 0.15