Linux – How to Disable Access Logging for Domains on CentOS & Apache

apache-2.2centoslinuxlogging

I am trying to disable access logging for domains on my dedicated server for over 10 HOURS. I read over 70 pages while I'm searching. I asked on Parallel's forum, I asked stackoverflow in another way.. still I can't disable access logging for domains.

Server configurations are not my profession, I may be considered as newbie to many people in this field.

Last time, I tried to disable it by adding CustomLog /dev/null plesklog to /var/www/vhosts/xxx.com/conf/vhost.conf and run /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=xxx.com (source). But It didn't work.

Please help me.

Best Answer

You really need to learn how to ask your questions, and stop repeating yourself (you've opened several posts for the same question, each with different details)...

Your question should say "How to disable access logs for all vhosts in Apache controlled by Plesk?"

From what I've read, there's no easy way because of the way Plesk creates/rewrites all apache .conf files everytime you modify something.

What someone did, was to create a shell script that replaces all instances of "CustomLog" by "#CustomLog" in all http.include files for each vhosts, and to add this script to the crontab so it runs every 15 minutes.

See his thread: http://forums.theplanet.com/lofiversion/index.php/t52435.html

I would use Perl to do in-place replacements however, like this. My version also only comments out the CustomLog lines if it's the first keyword on the line, and I made it so httpd only reloads (SIGHUP) instead of trying to start it, so it's better:

#!/bin/bash

for FILE in /home/httpd/vhosts/*
do
    perl -p -i -e "s/^[[:space:]]*CustomLog/#CustomLog/" "$FILE/conf/httpd.include"
done
service httpd reload
exit 0

Make sure this is run as root.

Related Topic