thcpanel

Member
Oct 23, 2010
8
0
51
How to disable domlogs for all accounts and include ssl logs?

I put this in my global virtualhost, but doesnt work
#CustomLog /usr/local/apache/domlogs/domain.com combined
#CustomLog /usr/local/apache/domlogs/domain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,271
1,243
313
Houston
Those lines need to be commented out in the apache template at /var/cpanel/templates/apache2_4/ and once their commented out you should rebuild the apache configuration and then restart apache
 

morrow95

Well-Known Member
Oct 8, 2006
160
8
168
I just came across this and would like to turn domlogs off as well. I edited :

/var/cpanel/templates/apache2_4/ssl_vhost.default

# CustomLog [% paths.dir_domlogs %]/[% wildcard_safe(vhost.log_servername) %]-ssl_log combined
# TransferLog [% paths.dir_domlogs %]/[% wildcard_safe(vhost.log_servername) %]-ssl_log
# CustomLog [% paths.dir_domlogs %]/[% wildcard_safe(vhost.log_servername) %]-bytes_log "%{%s}t %I .\n%{%s}t %O ."

/var/cpanel/templates/apache2_4/vhost.default

# CustomLog [% paths.dir_domlogs %]/[% wildcard_safe(vhost.log_servername) %] combined
# TransferLog [% paths.dir_domlogs %]/[% wildcard_safe(vhost.log_servername) %]
# CustomLog [% paths.dir_domlogs %]/[% wildcard_safe(vhost.log_servername) %]-bytes_log "%{%s}t %I .\n%{%s}t %O ."

To rebuild the httpd.conf file, run the following script:
/usr/local/cpanel/scripts/rebuildhttpdconf

To restart Apache, run the following script:
/usr/local/cpanel/scripts/restartsrv_httpd

After doing the above, /var/log/apache2/domlogs/* are still being written to. If I look at /etc/apache2/conf/httpd.conf there are no mentions of 'customlog' anywhere except for my hostname only. Am I missing something somewhere? Is there a default 'on' when CustomLog is not specified?
 

Steini Petur

Active Member
Apr 24, 2016
33
4
8
Iceland
cPanel Access Level
Root Administrator
I'd like to be able to take out CustomLog for a specific vhost, it use to be easy back in the day, this required very minimal such as change the vhost then distill and rebuild, but this is no longer the case the CustomLog line is not in the httpd.conf..

How can I disable the domlog for a specific account.
 

morrow95

Well-Known Member
Oct 8, 2006
160
8
168
/etc/apache2/conf.d/userdata/ssl/2_4/*username*/whatever.conf
/etc/apache2/conf.d/userdata/std/2_4/*username*/whatever.conf

in the conf you can put :

<IfModule mod_userdir.c>
CustomLog /dev/null combined
</IfModule>

ssl folder is with ssl - std folder is without ssl. By putting the conf in the username folder it means it applies to all domains that username owns. This will stop domlogs for ssl, std, and your bytes log (you won't have bandwidth stats anymore in whm/cpanel). There are other ways to do it so only the ssl log, only the std log, only the bytes, log or any combination of those are changed. You can read more at https://docs.cpanel.net/ea4/apache/modify-apache-virtual-hosts-with-include-files/

Remember to rebuild httpd and restart after making any changes.

To rebuild the httpd.conf file, run the following script:
/usr/local/cpanel/scripts/rebuildhttpdconf

To restart Apache, run the following script:
/usr/local/cpanel/scripts/restartsrv_httpd

With that said, I would still like to know why removing the CustomLog entries from the templates files does absolutely nothing. It is much easier to use that method then create all these folders and conf files in 'userdata' if you want to remove from all accounts.
 
  • Like
Reactions: cPanelLauren