Apache Log Files

Apache or with real name httpd provides logs. These logs are very helpful while detecting errors, attacks. There is two type of Apache logs by default. Log resides in following directories.

Log Path

Apache logs are stored in different paths because of name difference for different distributions. DEB or apt family uses the name apache2 and stores logs as apache2 but  the RPM yum family uses the name httpd and stores logs in the httpd directory.

/var/log/httpd/

  • CentOS
  • Redhat
  • Fedora

/var/log/apache2/

  • Ubuntu
  • Debian
  • Kali

Getting Log Files Directory

Log file directory can be changed with Apache configuration. Look in to configuration file to exact log path

Ubuntu,Debian,Kali

CentOS,Fedora, Red Hat

Error Logs

Error logs are generally related with service and http request errors. For different distributions different paths exists but generally similar paths are used.

We can read error logs like below. We use less to read.

We can also search error file with grep

Access Logs

Access logs generally provides http request related information and for busy site it will be generated a lot. Access log will provide following information about request or access attempts to our apache web server.

  • Client IP Address
  • Date and Time
  • Request URI
  • HTTP Status Code
  • Client Browser

Search For Specific HTTP Status Errors

We can search like error log with grep.In this example we will search for HTTP Status 404 errors in the access_log file.

1 Response

  1. Anonymous says:

    These apache logs are very helpful while detecting errors, attacks throughout the system. There are basically two types of Apache logs by default. To know more details, just go through the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)