Call Us: +90 850 532 5 260 Submit Ticket   Login
Clearing cPanel Logs on CentOS via SSH

Clearing cPanel Logs on CentOS via SSH

First of all, we should state that log files are automatically kept in every system today. Log files carry information that is bad on one hand but can save our lives on the other. Log files are generally used to keep a history of errors or operations in a file and to be able to check them later. However, some log files can be completely unnecessary. In this article, we will explain cPanel Log Cleaning and CentOS Log Cleaning processes step by step. Logs in cPanel are one of the biggest factors in the system crashing, freezing and causing malfunctions.

First of all, if you do not have a Putty, that is, a program that you need to connect to your server, you need to download it. (To Download Click.)

First of all, as you can see in the picture, it will be empty for you, you need to fill these fields appropriately when you download Putty.

Host Name (or IP Address): In this section, you need to write the IP Address of the server where CentOS (cPanel) is installed.

Port : You need to write your CentOS SSH Port in this section. If you haven't changed it, it is usually port 22. It can stay like this.

Saved Sessions : You can write whatever you want in this section. The benefit of this is that when we click Save, we will save the server with that name to Putty and you will not need to write the IP and Port again in later processes. You can leave it blank if you wish.

Load : This section shows you the information you have saved again, you can change or view it if you wish.

Delete : This button will help you delete what you have saved.

At least for our readers who don't know, we have also presented the places that will be useful for us in putty in this article. In fact, all you need to do is to write the Server IP and Port and open it with the Open Button, then enter the codes below.

 

 

When Putty is opened, type your server username and password and the codes to be applied in order are as follows.

 

Step 1 : Deleting WHM & cPanel “error_log” files.

With the code below, all logs will be deleted automatically.
find /home/*/public_html -name 'error_log*' | xargs rm -rf
With this code, we have deleted your “error_log” files for all sites on your server.

Step 2 : Deleting WHM & cPanel Log files.

First, we write this code and go to the directory where the log files are located:
cd /usr/local/cpanel/logs/
Then we delete all your log files from the directory with this code:
find . -type f -print -exec rm {} \;

Step 3 : Deleting Apache Log & Dom files.

First, we write the code below and go to the directory where the log files are located.
cd /usr/local/apache/logs
And then, with the code below, we clear all the log files in this directory.
find . -type f -print -exec rm {} \;

Additional ; Another log file ;
cd /usr/local/apache/domlogs/

To inform ; ls -lh | more | head -1 With this code, you can see the total size of all log files in the directory. Also, the log deletion process may take a long time depending on the size, please do not rush when it waits after each code.

About the Author

Leave a Reply

en_US