How to Check Apache Error Log and Access Log file

The purpose of logging in a server is to diagnose some issues. The common way to start the troubleshooting is to look at logs. For apache httpd server, all the log is normally stored at “/var/log/httpd” as below :

[root@centos62 ~]# ls /var/log/httpd/
access_log  error_log

How to Continuously Check Apache Error Log file :

[root@centos62 ~]# tail -f /var/log/httpd/error_log

Example :

[root@centos62 ~]# tail -f /var/log/httpd/error_log
[Thu Feb 16 18:23:08 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Feb 16 18:23:08 2012] [notice] Digest: generating secret for digest authentication ...
[Thu Feb 16 18:23:08 2012] [notice] Digest: done
[Thu Feb 16 18:23:09 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
[Thu Feb 16 19:56:33 2012] [error] [client 192.168.1.52] File does not exist: /var/www/html/favicon.ico
[Thu Feb 16 23:47:07 2012] [notice] caught SIGTERM, shutting down
[Sat Feb 18 20:39:26 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Feb 18 20:39:26 2012] [notice] Digest: generating secret for digest authentication ...
[Sat Feb 18 20:39:26 2012] [notice] Digest: done
[Sat Feb 18 20:39:27 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations

How to Continuously Check Apache Access Log file :

[root@centos62 ~]# tail -f /var/log/httpd/access_log

Example :

[root@centos62 ~]# tail -f /var/log/httpd/access_log
192.168.1.52 - - [16/Feb/2012:23:03:50 +0800] "GET /adminer/externals/jush/jush.css HTTP/1.1" 304 - "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/static/loader.gif HTTP/1.1" 200 673 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/?server=localhost&username=root&database= HTTP/1.1" 200 4739 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/static/plus.gif HTTP/1.1" 200 72 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root&database=" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
192.168.1.52 - - [16/Feb/2012:23:03:56 +0800] "GET /adminer/adminer/?server=localhost&username=root HTTP/1.1" 200 2977 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
192.168.1.52 - - [16/Feb/2012:23:03:56 +0800] "GET /adminer/adminer/?server=localhost&username=root&script=connect HTTP/1.1" 200 109 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
192.168.1.52 - - [16/Feb/2012:23:04:16 +0800] "GET /adminer/adminer/?server=localhost&username=root&status= HTTP/1.1" 200 19629 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
192.168.1.52 - - [18/Feb/2012:20:39:32 +0800] "GET / HTTP/1.1" 200 1394 "-" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
192.168.1.52 - - [18/Feb/2012:20:39:32 +0800] "GET /icons/compressed.gif HTTP/1.1" 200 1038 "http://192.168.1.44/" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"