Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email 



LOG FILES CLEANING


I always want to keep an eye on the volume of the log files. Very large log files often mean something is wrong with your computer. Then depending on what log file it is you can see, determines in what direction you should be looking.

Here is how I do that:

CODE
$ su
< password >
# du -s /var/log/* | less


Will page through less ( scroll with spacebar, close with ¨q¨ ) the logfiles and how many K they are. Also you can see if there are many .gz (zipped) files. We will get rid of those later. First have a look. Do also:

CODE
# du -s /var/log/*/* | less


And see if there are any strange large ones, and if there are many zipped ones. No zipped log files means a failing ¨logrotate¨ ( see below for info about anacron )

We will clean out the zipped log messages, because we do not need those anymore: ( be carefull typing, you are root !!! )

CODE
# rm /var/log/*.gz  


It will ask you for confirmation each time, just check if it really is a .gz file and type ¨yes¨ and hit enter.

Now we do the same with:

CODE
# rm /var/log/*.old


Now we do the same with:

CODE
# rm /var/log/*/*.gz


That should have removed quite a few files from your HD !!


If you have no .gz log files and they are many MB´s, that means logrotate does not do its job! Logrotate is a cron-job, a maintenance job that is performed every night between 3:00 and 4:00 AM. If your computer is not on 24/7 you should install anacron to do the maintenance at boot.

If you can´t find anacron on your Cds, get anacron: Here  and take the top one ( for made in Linux . . anacron-2.3-9mlx.i386.rpm ) download it and just install it by double clicking.

!! Anacron makes that your computer shows heavy activity 3 - 5 minutes after you boot up in the morning (afternoon). The activity is for about 5 minutes, so nothing to be worried about - no hacker´s activity - all normal maintenance jobs !!

One last tip: anacron needs no configuring, it should be pre-configured and run automatically . .


Bruno


-- Jul 6 2003 ( Revised Dec 12 2005 ) --


Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email