Viewing the Apache access log and error log
Apache maintains two primary log files: the access log and the error log. On ruachost.com, these logs help administrators monitor traffic, troubleshoot issues, and maintain server security.
Why Check Apache Logs?
Section titled “Why Check Apache Logs?”- Diagnose website errors and performance issues.
- Monitor visitor activity and requests.
- Detect suspicious or unauthorized access attempts.
- Verify server responses and application behavior.
Access Log
Section titled “Access Log”The access log records every request made to your server. It includes:
- Visitor IP address.
- Requested URL.
- HTTP response code (e.g., 200, 404, 500).
- Browser and operating system details.
Viewing Access Logs
Section titled “Viewing Access Logs”-
Managed Dedicated/VPS Accounts (cPanel): Access raw Apache access logs directly in cPanel → Metrics → Raw Access Logs.
-
Unmanaged Dedicated/VPS Accounts (SSH)
Section titled “Unmanaged Dedicated/VPS Accounts (SSH)”Terminal window sudo tail -100 /etc/httpd/logs/access_logOn Debian/Ubuntu systems:
Terminal window sudo tail -100 /var/log/apache2/access.log -
To search for specific requests (e.g., GET requests):
Terminal window sudo tail -100 /var/log/apache2/access.log
Error Log
Section titled “Error Log”The error log records warnings, errors, and anomalies encountered by Apache. Examples include:
- Missing files (404 errors).
- Permission issues.
- Misconfigured directives.
- Application errors.
Viewing Error Logs
Section titled “Viewing Error Logs”-
Managed Dedicated/VPS Accounts (cPanel): Access raw Apache error logs in cPanel → Metrics → Errors.
-
Unmanaged Dedicated/VPS Accounts (SSH)
Section titled “Unmanaged Dedicated/VPS Accounts (SSH)”Terminal window sudo tail -100 /etc/httpd/logs/error_logOn Debian/Ubuntu systems:
Terminal window sudo tail -100 /var/log/apache2/error.log -
To search for specific errors (e.g., invalid requests):
Terminal window sudo grep -i invalid /etc/httpd/logs/error_log