Introduction

There are two types of Apache server log files: error logs and access logs.

Error logs - set using "ErrorLog"

All Apache errors / diagnostic information and other errors found while serving requests are logged to an error log file. Location of error log is set using ErrorLog directive. If there is any problem, you should first take a look at this file.

Default Apache error log location are:

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

To find exact Apache error 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

A 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"

Access logs - set using "CustomLog"

Apache server records all incoming requests and all requests processed to a log file. The format of the access log is highly configurable. The location and content of the access log are controlled by the CustomLog directive.

Default Apache access log location are:

  • RHEL / Red Hat / CentOS / Fedora Linux - /var/log/httpd/access_log
  • Debian / Ubuntu Linux - /var/log/apache2/access.log
  • FreeBSD - /var/log/httpd-access.log

If the logs aren't there, try running grep. For example:

$ grep CustomLog /usr/local/etc/apache22/httpd.conf
$ grep CustomLog /etc/apache2/apache2.conf
$ grep CustomLog /etc/httpd/conf/httpd.conf

A sample output:

# a CustomLog directive (see below).
# CustomLog "/var/log/httpd-access.log" common
CustomLog "/var/log/httpd-access.log" combined

References & Resources

  • N/A