LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   In Apache server, How to change log file location and log format for access log fil? (http://www.linuxquestions.org/questions/linux-server-73/in-apache-server-how-to-change-log-file-location-and-log-format-for-access-log-fil-748788/)

since1993 08-19-2009 02:17 PM

In Apache server, How to change log file location and log format for access log fil?
 
I installed Apache server with Debian 5.0.2 Lenny. I am trying to write a script which would analysis web log files. I found the log files on /var/log/apache2. There is an access log file, `access.log`.
My question is what configuration file determines the location and the name of the access log file. How can I change them? I used CustomLog in /etc/apache2/apache2.conf like below.

LogFormat ": %h %l %u %t \"%r\" %>s %b" common
CustomLog /home/test/my_log_file common

Apache2 generated /home/test/my_log_file. But no logs were written in the file even after I run `/etc/init.d/apache2 restart`. I changed the log file location. It still didn't work. However, Apache2 still wrote logs in the file `/var/log/apache2/access.log`
Please help me.

bathory 08-19-2009 05:14 PM

Quote:

Apache2 generated /home/test/my_log_file. But no logs were written in the file even after I run `/etc/init.d/apache2 restart`.
Are you sure that the user that runs apache has write access in that directory? Also if you have vhosts enabled, check where their log files are located.

Regarding the logs format you can take a look at this. I prefer the combined CustomLog as contaims Referrer and User-Agent, that is good for web site log analysis.

Regards


All times are GMT -5. The time now is 11:24 AM.