5

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?

user4951
  • 10,519

3 Answers3

7

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.

mgabriel
  • 361
2

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.

Renan
  • 17,136
  • 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. – user4951 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
1

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.

psusi
  • 17,303