Apache Error Log Files

Apache Error Log File

All apache errors / diagnostic information other errors found during serving requests are logged to this file. Location of error log is set using ErrorLog directive. If there is any problem, you should first take a look at this file using cat, grep or any other UNIX / Linux text utilities. This apache log file often contain details of what went wrong and how to fix it. Default error log file location:

  • RHEL / Red Hat / CentOS / Fedora Linux Apache error file location –/var/log/httpd/error_log
  • Debian / Ubuntu Linux Apache error log file location – /var/log/apache2/error.log
  • FreeBSD Apache error log file location – /var/log/httpd-error.log

To find exact apache log file location, you can use grep command:
# grep ErrorLog /usr/local/etc/apache22/httpd.conf
# grep ErrorLog /etc/apache2/apache2.conf
# grep ErrorLog /etc/httpd/conf/httpd.conf   (works for centos,redhat tested)

 

Sample output:

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a 
ErrorLog "/var/log/httpd-error.log"

How do I change Apache log file location?

Simply edit apache configuration file and change the location. You need define new location using CustomLog or ErrorLog:

ErrorLog "/home/httpd/cyberciti.biz/rawlogs/httpd-error.log"
CustomLog "/home/httpd/cyberciti.biz/rawlogs/httpd-access.log" combined

Save and close the file. Restart httpd:
# service httpd restart

 

Credits:cyberciti.biz

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.