cmafia
Jan 11 2003, 01:35 AM
Since I've seen several people asking this same question, I decided to put this up as a HowTo for people. Once again, this goes out to Webbcite for a thank you!
Clearing Email Sent To Mail Root:
cat /dev/null > /var/spool/mail/root
Clearing Logs:
cat /dev/null > /var/log/logname
Thanks old great evil smiling sun in the sky!
Cajun
noob du jour
Jan 30 2003, 01:00 AM
Can any log in /var/log and its directories be emptied this way, and what are the repercussions?
btw thanks so much to the responsive people on this board! I wish I'd known to come here first before spending umpteen hours on the ensim site looking for non-existent answers.
cmafia
Jan 30 2003, 03:47 AM
Ensim's support site is a SUCKAZAURUS!! It's funny, though, most people here are starting to post over there.
By the way, the answer to your question is yes.
Cajun
mbennett
Jan 31 2003, 12:48 AM
i dunno if this had anything to do with it but less than an hour after i ran these commands my server died and needed a restore. Im sure they didnt but just letting ya know. My init wasnt found on a reboot so i dunno if they removed somethings they shouldnt
cmafia
Jan 31 2003, 01:57 AM
I've used these commands to clear log files for a while now with no problems.
Cajun
avio07
Feb 23 2003, 05:39 PM
Thank you so much, I have been looking for this all over the place. Thank you thank you!!
One question though, does this clear all the logs on the server? All sites logs are cleared and stuff? Or only the server ones?
cmafia
Feb 24 2003, 04:50 AM
You can use these to clear all server logs. If you go into /var/logs , you can clear any in there.
Cajun
Owen
Feb 24 2003, 10:08 AM
Nice, though the root mail cleaner isnt necessary for me though as ive set it up so that mail gets sent to another account which i use to view such email anyway, though nice alternative for me to use to delete the logs, cheers

.
mouse
Feb 24 2003, 01:27 PM
Just wondering, are these the same commands which prompted your thread in the Ensim catagory with the word "ooops"? lol.. Mouse
kryton
Mar 5 2003, 12:43 AM
My site uses a lot of CGI and my suexec_log grows fast. I have a daily cron which justs "mv suexec_log suexec_log.1"
If I can do this why can't you just delete any log? In case the error trapping of the program which uses the log is not good enough?
dafonso
Mar 5 2003, 06:16 PM
QUOTE
Originally posted by kryton
My site uses a lot of CGI and my suexec_log grows fast. I have a daily cron which justs "mv suexec_log suexec_log.1"
If I can do this why can't you just delete any log? In case the error trapping of the program which uses the log is not good enough?
When you delete a file, you don't close it. Only when the file is closed, and the INode released is the space given up. The Inode belonging to that file is still in use, and still receving data from apache. So the used space on your disk grows, but there's no file attached to it. When you use his trick (which effectively onyl sets the file size to 0) if resets the EOF pointer to the beginning of the file, and frees the disk space.
top500
Apr 27 2004, 10:48 PM
tip:
I use crontabs to delete logs daily (especially mail/root)
things are better now.
*s*
DigitalIce
Jan 13 2005, 08:35 PM
in /var/log/httpd I have this:
-rw-r--r-- 1 root apache 685213324 Jan 13 21:36 suexec_log
Is it "OK" to use the above method to delete this or would it be harful to do so?
mouse
Jan 14 2005, 03:08 AM
QUOTE
Originally posted by DigitalIce
in /var/log/httpd I have this:
-rw-r--r-- 1 root apache 685213324 Jan 13 21:36 suexec_log
Is it "OK" to use the above method to delete this or would it be harful to do so?
yes that would be fine... Mouse
jorge
Jan 26 2005, 12:14 AM
how would you run this as a cronjob?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.