Find and review server logs
Managing a VPS or Dedicated server will require the review of logs when troubleshooting issues. This article will detail the common logs used and their respective locations.
Why would I need to look at log files?
- I don't know what's causing the issue.
- I have no idea where to start troubleshooting the issue.
- The issue only happens to some users.
- The "fix" I tried didn't resolve the issue.
Apache
Apache logs visitors to each site hosted on the server. A single visitor can generate multiple requests depending on the page. Most requests fall into 2 categories: GET (ie: show me an image) and POST (ie: logging into a site). The access logs also contain the timestamp, client IP address, and browser info.
cPanel Location:HTTP log:
/usr/local/apache/domlogs/$DOMAINHTTPS log:
/usr/local/apache/domlogs/$DOMAIN-ssl_log
Plesk Location:
HTTP logs:/var/www/vhosts/system/$DOMAIN/logs/access_logHTTPS logs:
/var/www/vhosts/system/$DOMAIN/access_ssl_logWhen should I review Apache Access logs?
- To see if a client’s connection makes it through the internet and firewalls and into Apache.
- If there is a problem with content editing in a CMS, the apache logs should still log a POST request. If there is no POST request, you should check the DNS, firewall(s), and the application.
- To check for DOS attacks by parsing data from these logs.
PHP
The PHP Error log contains information about errors in specific PHP files, calls to missing files, or errors related to the configuration of PHP. PHP error logs are normally found within your site's files. You can use a PHPinfo() page to confirm the log location.
Where can I find this log?cPanel Location:
/home/cpanel_username/logs/$DOMAIN.php.error.logPlesk Location:
/var/www/vhosts/$DOMAIN/logs/$DOMAIN.php.error.logWhen should I review the PHP error log?
Anytime you are troubleshooting an issue that appears isolated to one or more PHP-based (like WordPress) sites, but not the entire server.
MySQL
MySQL error log will contain information about service failures, resource issues and crashed database tables.
Where can I find this log?For MySQL 5.5, 5.6 and MariaDB 10.2
/var/lib/mysql/$HOSTNAME.err
For mysql 5.7 and later and MariaDB 10.3 and later
/var/log/mysqld.logWhen should I review the MySQL error log?
- The MySQL service will not run.
- The MySQL service is using excessive memory or CPU.
- Your database driven site (ie. WordPress) is slow.
- Your database driven site is unable to connect to MySQL.