Access and Error Logs – what they are, how do I activate them and how are they useful to me?
The access and error logs are the raw web server statistics, which have been generated with every visit to your website. They are quite useful when you would like to check who has visited your website, what response code from the server they have received, and whether there were any error messages. You can activate the access and error logs for one or for all your domains, from the Statistics > Access & Error Logs section of your Web Hosting Control Panel. However, due to the fact that these logs are increasing their size, our server is automatically deleting them once in every 48 hours, and that is why it is recommended to regularly download them to your local computer in case you may later need them for your reference. In addition, we also offer you a way to store these logs directly to your account using the following method:
- Go to the Files > File Manager section of your Web Hosting Control Panel
- Create an empty file called move_logs.sh in the /www/ folder of your account
- Once created, edit the file using the plain text editor (select the Click to edit this file icon, next to the file)
- Insert the following code in it:
cp /home/logs/my-best-domain.com-access.log /home/www/access-error-logs/$DIR1
cp /home/logs/ my-best-domain2.com-access.log /home/www/access-error-logs/$DIR1
cp /home/logs/my-best-domain.com-error.log /home/www/access-error-logs/$DIR2
cp /home/logs/my-best-domain2.com-error.log /home/www/access-error-logs/$DIR2
In the above code, make sure to replace my-best-domain.com
with your actual domain or subdomain.
From the Advanced> Cron jobs section, create a cronjob, which will execute the newly created move_logs.sh script once a day (learn how to set up a cron job here: How to set up a cron job)
This will generate the logs directly into your account and make them available as long as your account is active.