Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    Sofia
    Posts
    1,354

    Cleaning log files

    Hello,

    I have found that my audit.d directory is periodically getting full of 20 MB logs which cause the server to crash when the /var gets over the mark of 85%. These are about 100 files to be manually cleaned up every two weeks, or the server will crash.

    Should I use some cron script or there is other ways to cope with the problem?

    And a second question:
    The mysqld.log is well over 3.5 GB and takes about 60% of the alotted var space. What would you suggest to do with it?

    TIA

  2. #2
    Join Date
    Jan 2004
    Location
    Greece
    Posts
    2,211
    It's safe to delete mysqld.log and then restart the mysql server. Then you will have more free space for your audit.d directory.

  3. #3
    Join Date
    Feb 2004
    Location
    Sofia
    Posts
    1,354
    Thanks, I have just overwritten it with an empty file, thus freeing more than 50% from /var. Now it is only 8% used.

    What I need is help how to compose a cron script telling the machine to delete all save.n files in /var/log/audit.d where n =>1

    Or, as I now realised, to decrease the number of save.n files to 20 - because I've never seen there files with n>100

  4. #4
    Join Date
    Jan 2004
    Location
    Greece
    Posts
    2,211
    You can put a shell script inside /etc/cron.weekly

    The shell script is that:

    #!/bin/bash
    rm -fr /var/log/audit.d/save.*

  5. #5
    Join Date
    Apr 2004
    Location
    San Jose
    Posts
    902
    Check out logrotate.
    Specializing in MySQL and website tuning for high traffic sites. cmwsci.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •