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

Re: Trimming down of /var/log/messages



On Sun, Sep 03, 2000 at 09:56:36PM -0700, Alvin Oga wrote:
> 
> hi ya
> 
> make sure cron is running....it already rotates log files
> weekly/monthly... at least on the 1u raid5 debian box
> i poke around in
> 

I need to do some reading on 'cron', and actually do
some fine-tuning.  I have 'cron' running but it does
not seem to rotate my log files as routine. The size
of my messages file is over 1 mb and it has not been
rotated at all.

If someone can give an input in this direction .. it
would be of great help.


> if you want to manually rotate your logs....
> 
> kill syslogd or sysklogd....than move it aside...
> but you must also kill things like the web server
> too that logs stuff into /var/log/httpd/ and more stuff to retart
> 

Oh No! For a non-techie like me that would surely be
a nightmare !

> simple silly way...that will always work...
>     - mv /var/log /var/log.old ; mkdir /var/log
>     - reboot
> 	- and it should all be cleaned up by itself
> 

No, this simple hack is not the answer. I did try it
out because of its simplicity. However, the /var/log
directory has other stuff which are  needed by other
programs. The following went kaput:

a. dwww.
b. Apache server of my two computer local network at
   home.
c. news.

There may be more, but I did not try others out, and 
restored the system back with the old /var/log.

Thanks for the hint anyway!  The stupid old me never
thought of doing it at shut-down, with a fix on cron
and boot-up.  This lit up a spark in me though.  The 
following had no problems with multiple reboots:

   #!/bin/sh
   # --------------------------------------
   # Script to rotate /var/log/messages
   # to be run with root privileges
   # --------------------------------------
   rm -rf /var/log/messages.old
   mv /var/log/messages /var/log/messages.old
   touch /var/log/messages
   reboot
   
For a quick hack, this works. I think I will keep a
tag on fast growers in the /var/log subdir, and try 
to attack specific files rather than move the whole 
subdirectory.

USM Bish

> 
> On Mon, 4 Sep 2000, USM Bish wrote:
> 
> > 
> > Is there a recommended way wherein I keep the log for the
> > last seven days only, with some process at boot-up or cron ?
> > 
> > USM Bish
> > 



Reply to: