Updated on Sep 7, 2018
In this tutorial, we will show you how to remove access logs from cPanel's Awstats tool. While you can remove only the IP address list of your visitors, it is also possible to completely erase all of the statistics for a certain month. However, to make any of these actions, you will first have to find the Awstats file containing all of the data.
As with most tutorials, you will start by logging in the cPanel of your hosting account. Once there, click on the File Manager icon which should be one of the first icons you see in cPanel.
As an example, if we now check the Hosts section in Awstats for a domain for the month of May, we will see a list of visitor IP addresses like the one below.
To access the file containing that information, navigate from your File Manager to the /tmp/awstats folder with a path home/yourusername/tmp/awstats. Here you will have to look for the appropriate file, especially if you have multiple domains and subdomains. In our case, the file's name is awstats052018.test.com.txt. As you can see the month and year are part of the name of the file, for an easy search.
In the file editor, you can use Ctr+F to search for "BEGIN_VISITOR". This is the start of the IP address list, and there will be all of the IP addresses that have accessed that domain.
To remove them all, select all of the IP addresses from "BEGIN_VISITOR" until you get to "END_VISITOR". Don't forget to click on the Save Changes button to save the file.
Now if you go again in your Awstats and click on the same domain, you will see an empty Hosts section.
If you wish to remove all of the statistics for that month and that domain, delete the entire text file. Please note, that removing the file without creating a backup of it will result in that statistic information being lost. In our case, if we remove awstats052018.test.com.txt, we will then see the following in Awstats.
With this, you now know how to remove sensitive information and entire months of logs from Awstats.