LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Best way to delete old unwanted log files?? (https://www.linuxquestions.org/questions/linux-newbie-8/best-way-to-delete-old-unwanted-log-files-678859/)

xmdms 10-24-2008 01:15 PM

Best way to delete old unwanted log files??
 
Hello Linux Gurus,

What would be the best way to purge old unwanted files by the volume without bringing down the server due to spike CPU processing?

Please advise.

Thanks,
J

jailbait 10-24-2008 01:28 PM

I recommend that you use logrotate.

http://linuxcommand.org/man_pages/logrotate8.html

-----------------------
Steve Stites

xmdms 10-24-2008 02:11 PM

These log files are being generated through in-house process. Could I use this utility "logrotate" to clean up other log files being generated through other process? There are couple thousands of these files and I would like to clean them up on a daily bases.

Thank you so much for your advice.

J

onebuck 10-24-2008 02:32 PM

Hi,

Yes!

Code:

excerpt from 'man logrotate';

LOGROTATE(8)            System Administrator's Manual            LOGROTATE(8)

NAME
      logrotate - rotates, compresses, and mails system logs

SYNOPSIS
      logrotate [-dv] [-f|--force] [-s|--state file] config_file+

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

      Normally, logrotate is run as a daily cron job.  It will not  modify  a
      log  multiple  times  in  one  day unless the criterium for that log is
      based on the log's size and logrotate is being run multiple times  each
      day, or unless the -f or -force option is used.

      Any number of config files may be given on the command line. Later con-
      fig files may override the options given in earlier files, so the order
      in  which  the logrotate config files are listed in is important.  Nor-
      mally, a single config file which includes any other config files which
      are  needed  should  be used.  See below for more information on how to


trickykid 10-24-2008 03:48 PM

If logrotate doesn't work for you, you can also look into using tmpwatch which comes with most standard distributions.

xmdms 10-25-2008 11:31 AM

I will check it out - Thank you!

Would you know how to configure it?

J

xmdms 10-27-2008 09:36 AM

On the next question;

Would you guys know how to deal with OCFS/OCFS2 Filesystem? I am trying to list out some files in there and it's taking an hour to do so, not mentioning delete files.

Any ideas??

Thanks,

J


All times are GMT -5. The time now is 02:14 PM.