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 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:
Plesk Location:HTTP logs:
/var/www/vhosts/$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.
Most web service and application errors will be in the Apache Error log. The log will contain resource errors, PHP errors, and other errors to aid in troubleshooting.
Where can I find this log?
/var/log/apache2/error_logWhen should I review the Apache Error log?
The Apache error log should always be reviewed when troubleshooting a site-related issue. This includes internal server errors and intermittent performance issues.
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?
/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.
The PHP-FPM error log will contain errors related to the PHP-FPM service. There may be multiple logs if you utilize multiple versions of PHP.Where can I find this log?
/opt/cpanel/ea-phpXX/root/usr/var/log/php-fpm/error.logXX would be 73 for PHP-FPM 7.3.
CentOS w/Plesk location:
/var/www/vhosts/$DOMAIN/error_logUbuntu w/Plesk location:
/var/www/vhosts/$DOMAIN/logs/php-fpm_error.logWhen should I review the PHP-FPM log?
- Your site displays a 503 error.
- Your site is loading slowly or intermittently.
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
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.