Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am running CentOS with cPanel, which creates a custom log directory and writes the logs there. The result is that the IO for the hard disk goes sky high.

If I do lsof I got:

hostsite.com

httpd      2383    nobody 3779w   REG  253,0         0  422463 /usr/local/apache/domlogs/mygamecardotcobnao.super                  hostsite.com-bytes_log
httpd      2383    nobody 3780w   REG  253,0      5265  420994 /usr/local/apache/domlogs/myfreefreedatixuua.super                  hostsite.com
httpd      2383    nobody 3781w   REG  253,0        36  422464 /usr/local/apache/domlogs/myfreefreedatixuua.super                  hostsite.com-bytes_log
httpd      2383    nobody 3782w   REG  253,0      3101  415849 /usr/local/apache/domlogs/myfreedatingfrekeuo.supe                  rhostsite.com
httpd      2383    nobody 3783w   REG  253,0        72  422465 /usr/local/apache/domlogs/myfreedatingfrekeuo.supe                  rhostsite.com-bytes_log
httpd      2383    nobody 3784w   REG  253,0       672  419338 /usr/local/apache/domlogs/myfreedatingblogsxgo.sup                  erhostsite.com
httpd      2383    nobody 3785w   REG  253,0         0  422466 /usr/local/apache/domlogs/myfreedatingblogsxgo.sup   

Disabling this domlog is impossible because there are tons of those lines automatically generated.

I just want to point /usr/local/apache/domlogs/ to /dev/null. Can that be done?

share|improve this question
1  
Does it stop working if you remove permissions to that directory? (chmod 0 /usr/local/apache/domlogs/) or remove it altogether? Can you create those log files beforehand as symlinks to /dev/null? –  Stéphane Chazelas Dec 28 '12 at 1:41
    
maybe I should symlink domlogs to /dev/null –  Jim Thio Dec 28 '12 at 4:55
    
No idea if it's stable but nullfs might be something for you: github.com/xrgtn/nullfs –  ThiefMaster Jan 4 '13 at 22:07

3 Answers 3

up vote 6 down vote accepted

If you can afford some RAM, you can set up a RAM disk and let your logs go there:

mount -t tmpfs -o size=200M none /usr/local/apache/domlogs

Additionally, you should setup logrotate to rotate the logs every minute/hour/day/night/week/* and delete the old logs. This is not exactly what you want, but it should fix your problem as RAM I/O won't slow down your disks.

share|improve this answer
    
This would be the best solution IMHO. –  Renan Dec 28 '12 at 2:24
    
I have huge ram. I simply do not need the log though. Interesting. –  Jim Thio Dec 28 '12 at 4:50
    
what would be the command to mount /usr/local/apache/domlogs to /dev/null instead? –  Jim Thio Dec 28 '12 at 4:56

A not-very-good solution (the ones proposed in other answers are much better), but you could remove the directory and them symlink it to /dev/null. But then, applications might start failing when they try to write to that directory and find that it's not actually a directory.

share|improve this answer
    
how to do so? I really don't need this domlogs and there is no easy way for cpanel to just don't write those log. –  Jim Thio Dec 27 '12 at 23:53
    
Delete the directory (e.g. rm -rf /usr/local/apache/domlogs) and replace it by a symlink (ln -s /dev/null /usr/local/apache/domlogs). –  Renan Dec 27 '12 at 23:58

No, you can not, because /dev/null is a file ( devnode actually ), not a directory. You can not create files inside it. You will need to configure the app not to bother creating these logs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.