How do I disable apache error.log globally?

OooLong

Well-Known Member
Mar 16, 2011
105
1
68
cPanel Access Level
Website Owner
I want to know how to disable error.log globally. I understand the risk that come with it. I just want to do it. I was able to find one for access_log and disable it:

#CustomLog logs/access_log combined

but error_log does not exist in /etc/apache2/conf/httpd.conf

Where do one go to disable it /etc/apache2/logs/error_log?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463
Hello,

You can disable error logging for all virtual hosts on the system, but note that you will still see a limited number of entries in the Apache error log (e.g. Apache restarts). To do this, you should first create the required directory and include file:

Code:
mkdir /etc/apache2/conf.d/userdata
touch /etc/apache2/conf.d/userdata/errorlog.conf
Then, edit /etc/apache2/conf.d/userdata/errorlog.conf so that it contains the following line:

Code:
ErrorLog /dev/null
The last step is to rebuild the Apache configuration file and restart Apache:

Code:
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd
Thank you.