Apache Log Files
Q. How do I find out Apache http server log files location? How do I change the location of Apache log file under Linux / UNIX operating system?
A. There are two type of apache httpd server 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
Sample output:
# ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within aErrorLog "/var/log/httpd-error.log"
Apache Access Log File
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 file location:
- RHEL / Red Hat / CentOS / Fedora Linux Apache access file location - /var/log/httpd/access_log
- Debian / Ubuntu Linux Apache access log file location - /var/log/apache2/access.log
- FreeBSD Apache access log file location - /var/log/httpd-access.log
To find exact apache log file location, you can use grep command:
# grep CustomLog /usr/local/etc/apache22/httpd.conf
# grep CustomLog /etc/apache2/apache2.conf
# grep CustomLog /etc/httpd/conf/httpd.conf
Sample output:
# a CustomLog directive (see below).
#CustomLog "/var/log/httpd-access.log" common
CustomLog "/var/log/httpd-access.log" combined
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
E-mail
Print
Can't find an answer to your question? Contact us
Related Other Helpful FAQs:
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: /var/log/apache2/error.log, /var/log/httpd-error.log, /var/log/httpd/error_log, access file, apache error log, apache http server, apache log files, apache server, apache web server, default error, text utilities, web server log



June 14th, 2008 at 2:34 pm
You can also use the following command to find the log files if the apache instance is running.
lsof -p |grep -i logs
This would give the access and the error logs.
Cheers,
rOOtUser
June 14th, 2008 at 2:35 pm
Disregard the previous command.
lsof -p pid-of-httpd | grep -i logs