Apache error log and access log

Most of us use Apache Web Server for running our website or web application. So in this article, we will just talk about Apache log files. Apache records each request to the server, errors and events in the log files. We can use these files information for monitoring. By default Apache have two log files.

1. access_log
2. error_log

After Apache installation, these two files doesn't exists. These files gets created once you start the apache first time.


Apache records each client requests in this file. It includes the IP address,
date and time, request type GET/POST, the file requested.

sameple access log - - [26/Apr/2011:11:41:18 0530] "POST /node/add/blog HTTP/1.1" 200 "http://localhost/node/add/blog" - - [26/Apr/2011:11:41:25 0530] "GET /misc/feed.png HTTP/1.1" 304 - "http://localhost/node/add/blog" - - [26/Apr/2011:11:41:26 0530] "GET /css/css_75ca1854e6945c8fb65827af207b46de.css HTTP/1.1" 200 "http://localhost/node/add/blog" - - [26/Apr/2011:11:41:26 0530] "GET /js/js_7dcc6d81b0295619b7c6f5257e3b5e80.js HTTP/1.1" 200 "http://localhost/node/add/blog"


Apache records the startup messages, error messages and events details in this file. If you get error in the web application, you have to look this file first to get the error details.

sample error file

[Fri Apr 29 17:02:12 2011] [error] [client] File does not exist: C:/apache/htdocs/misc, referer: http://localhost/admin/
[Sat Apr 30 11:26:17 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Sat Apr 30 11:26:17 2011] [notice] Child 5692: Exit event signaled. Child process is ending.

In linux, these file names are: access_log and error_log. In windows, it would be access.log and error.log.

You can use tail command to view the log files / current information written to thses files, instead of open and view each time.