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:

  1. Go to the Files > File Manager section of your Web Hosting Control Panel
  2. Create an empty file called move_logs.sh in the /www/ folder of your account
  3. Once created, edit the file using the plain text editor (select the Click to edit this file icon, next to the file)
  4. Insert the following code in it:
    #!/bin/bash 
    DIR1=`date +%d%b%Y`access 
    mkdir /home/www/access-error-logs/$DIR1/ 
    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 
    DIR2=`date +%d%b%Y`error 
    mkdir /home/www/access-error-logs/$DIR2/ 
    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.

  5. 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.