Results 1 to 5 of 5
Thread: Cleaning log files
-
06-23-2006, 10:21 AM #1Web Hosting Master
- 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
-
06-23-2006, 12:31 PM #2Greece
- 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.
-
06-23-2006, 12:39 PM #3Web Hosting Master
- 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
-
06-23-2006, 02:13 PM #4Greece
- 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.*
-
06-24-2006, 02:53 AM #5Web Hosting Master
- Join Date
- Apr 2004
- Location
- San Jose
- Posts
- 902
Check out logrotate.
Specializing in MySQL and website tuning for high traffic sites. cmwsci.com/