Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Log files (access_log)

Status
Not open for further replies.

Saeed42

ISP
Jul 4, 2001
147
I'm trying to change where apache writes to the access log files but I'm not having any luck, as you can see below I committed out the default path and added a new one then restarted httpd server but, it's still writing to the default directory, any idea why?

(# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
# CustomLog logs/access_log common
#CustomLog logs/access_log combined
CustomLog /var/ combined

Info
Redhat 8.0
dedicated server.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Don't be content with being average. Average is as close to the bottom as it is to the top
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Ok two things here (or maybe more) ....

1) does /var/ exist ? and who has permissions to it
2) Take care as there is a further line in httpd.conf that also defines combined log format .....

<CUT>

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
# CustomLog /var/log/httpd/access_log common
CustomLog /var/log/httpd/access_log combined

#
# If you would like to have agent and referer logfiles, uncomment the
# following directives.
#
#CustomLog /var/log/httpd/referer_log referer
#CustomLog /var/log/httpd/agent_log agent

#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#

#CustomLog /var/log/httpd/access_log combined

#
# Optionally add a line containing the server version and ........

<END CUT>

3) you can also define the location in a .htaccess file so as long as you own/know your server then this not likley.

4) Virtual hosts can have their logfile path defined in their virtual host statments (usually somewhere towards the end of the httpd.conf).

I hope this helps.

Oh! and last but not least, be sure you are modifing the correct httpd.conf ( there may be more than one if Apache had been installed by someone else at some time) Check /etc/init.d/httpd to see where httpd is looking for its configuration file.

Good Luck.
Laurie.
 
I created that directory and gave everyone permission to write (777), I also copied all of the old log files into that directory.

Virtual hosts not setup
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

Definitely configuring right httpd.conf file



Thanks for your prompt response


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Don't be content with being average. Average is as close to the bottom as it is to the top
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
And the logfiles that you copied in are writable by apache(or who ever runs the webserver)?

Ok so are the log entries going into the old log file ?


Try this (if all the other things are correct):

1) STOP Apache.
2) delete (ok copy away) the logs from the old orig dir
3) delete the logs from the new dir
4) START Apache and tell me where the access & error logs are created ?

L.
 
Thanks guys it's now working after following Tarn's Instructions.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Don't be content with being average. Average is as close to the bottom as it is to the top
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Magic!

Sometimes you will find that the logfile remains open if apache has any process still running (Apache processes refuse to let go of it) and therefore no matter what you do apache will ignore your new file and continue to write to the old file.

This is a minor problem if you want to do your own log roll at the end of every day (the only way is to copy the logfile to new file, stop Apache delete (ok cat /dev/null > ) old logfile; restart apache.

Or use apache/bin/rotatelogs

Glad your fixed.

I can make my way to Birmingham NEC 2 C Simply Red Live now a happy bunny.

Laurie.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top