How to Disable Apache Access Logs in Directadmin for All Domains

,

How to Disable Access Logs in Directadmin for All Domains

Every domain in DirectAdmin has an Apache access log, but often, the results could be more helpful and filled with bot-generated entries. These logs can quickly grow in size, taking up valuable backup space. Additionally, writing log information is a time-consuming process that utilizes processor cycles. If storing log information is not necessary for your needs, disabling access logs can help optimize your Directadmin server.

To turn off access logs for all domains in DirectAdmin, follow these steps:

Step 1: Navigate to the Templates Directory

Open your terminal and enter the following command:

cd /usr/local/directadmin/data/templates

Step 2: Create a Custom Template

Copy the virtual_host2*.conf files to the custom directory by running the command:

cp virtual_host2*.conf custom

Step 3: Access the Custom Template Files

Move into the custom directory by executing the following:

cd custom

Step 4: Edit the Template Files

Open each of the following files one by one using a text editor of your choice:

nano /usr/local/directadmin/data/templates/customvirtual_host2.conf
nano /usr/local/directadmin/data/templates/customvirtual_host2_secure.conf
nano /usr/local/directadmin/data/templates/customvirtual_host2_secure_sub.conf
nano /usr/local/directadmin/data/templates/customvirtual_host2_sub.conf

Step 5: Modify the Log Configuration

Within each file, locate the line that reads:

CustomLog /var/log/httpd/domains/|DOMAIN|.log combined

Replace it with the following line:

CustomLog /dev/null combined.

Step 6: Save and Exit

Save the changes you made to each file and exit the text editor.

Step 7: Queue the Rewrite Task

To apply the changes, run the following command:

echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue

By following these steps, you can effectively turn off access logs for all domains in DirectAdmin. This will help optimize your server’s performance and conserve valuable resources.

en_USEnglish