Advanced - Error Logs
Check your Error Log files to identify site problems.
Advanced Plans come with detailed error logs which contain useful system messages regarding your website: pages not found, unusual behaviour, blocked users, etc.
We recommend all clients review their Error Log files daily to identify possibly hack attempts and broken links within the website.
To view your error log file at any time, login to the user Control Panel and click the icon that links to 'error log'.
This will then show you the last 300 error messages that have resulted from direct usage of your website.
These system messages are extremely useful when trying to identify faults or problems with your site or scripts.
We give you some examples of common system messages and what you can do if you see them.
File does not exist: /home/username/public_html/file.html
This message tells you that somebody tried to find a page on your site that was not there. This may be because you have an old link pointing to a page that you have since removed, or, you have not yet uploaded the page to the website.
If the page is actually dead and you don't want to have it on your website, you can setup a permanent redirect to route visitors from this page to a different page on your site.
File does not exist: /home/username/public_html/401.shtml
Again, this refers to a page that was not found. However, in this case it is the default system error page that could not be located. We recommend you customize system error pages. To do so, login to the Control Panel and click the icon that links to Error Pages. From there you can customize your 400, 401, 403, 404 and 500 error pages.
More examples to be added soon.
| Automate Email Error Logs |
We recommend you view error logs on a daily basis. If you have a number of different sites to monitor, this may be a time consuming process however, to make things easier, you can setup a cron run script to email yourself a copy of the error log daily.
Error Log Script
Copy and paste the following code into a new file and name it: 'errorlogs.php' ...
<?php
$ch = curl_init();
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_URL, '#1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, '#2:#3');
$content = curl_exec($ch);
curl_close($ch);
$pattern = '/\<pre\>(.*?)\<\/pre\>/si';
preg_match($pattern, $content, $matches);
mail('#4', '#5', $matches[1]);
?>
Make sure you make the following changes to the code ...
#1 - enter your route to the log file. To find out what this is, login to your Control Panel, click on the 'error log' icon and the log file page will open. Copy this url into the code so it replaces the #1 variable.
#2 - enter your Control Panel username
#3 - enter your Control Panel password
#4 - enter your email address
#5 - enter the title of the email (eg: Log File)
When done, save the file and upload to your server. We recommend you DO NOT place this file inside the public_html directory but instead create a new directory ABOVE so it is not publicly available.
Error Log Cron
Once the script is on the server, login to your Control Panel and click the icon that links to 'cron jobs' and select the 'advanced' option.
Where you see the text box entitled 'Please enter an email address where the cron output will be sent', enter your email address.
Now we are going to set a cron task to force the script to run daily. You will see a number of boxes that should be filled out as follows ...
Minute - enter a number from 0-60
Hour -
enter a number from 0-24
Day - leave as asterisk (*)
Month - leave as asterisk (*)
Weekday - leave as asterisk (*)
In the 'command' box enter the following command ...
php -q /home/username/errorlogs.php
Replace 'username' with your Control Panel username.
When done, click 'commit changes' and you are done.
Your cron task will run in the next 24 hours at the time you have set it and you will receive 2 emails ...
1 - confirmation from the system that the cron task has run
2 - a copy of the error log file showing the last 300 errors
If you don't want to receive the confirmation email, add '> /dev/null' to your command so it looks like ...
php -q /home/username/errorlogs.php > /dev/null
|