Forum Moderators: phranque

Message Too Old, No Replies

Subdirectory Logging

         

raenef

4:24 am on May 6, 2005 (gmt 0)

10+ Year Member



Hello, Im a newbie webmaster running a small home server hosting my site and my cousin's

My folder heiarchy looks like:
wwwpub/cataclypse (my site)
wwwpub/ams (his site)

And I was wondering if there were a way to set up seperate log files for each of our sites instead of logging everything into the one access log.
Much Appreciated,
~Raenef

sitz

1:14 pm on May 6, 2005 (gmt 0)

10+ Year Member



Yep; use the SetEnvIf [httpd.apache.org] directive in conjunctino with CustomLog [httpd.apache.org]; something like this:

SetEnvIf Request_URI "^/ams(/¦$)" ams_request
SetEnvIf Request_URI "^/cataclypse(/¦$)" cataclypse_request

CustomLog logs/ams-requests.log common env=ams_request
CustomLog logs/cataclypse-requests.log common env=cataclypse_request

Make sense?

raenef

9:01 pm on May 6, 2005 (gmt 0)

10+ Year Member



Ah yes, it might take me a minute to figure out how to implement since Im new to this.
But thanks much :-)

raenef

9:47 pm on May 6, 2005 (gmt 0)

10+ Year Member



I've put that in the httpd config file.
And the logs would appear but remain at 0kb after I visted my site and his. Yet the entries still appear in the main access log.
Any ideas?

sitz

3:03 pm on May 7, 2005 (gmt 0)

10+ Year Member



Hrm. It works for me here; it sounds like you may have configured the CustomLog directives in one VirtualHost block but the requests you're making are for another. Or, you configured them CustomLog directives in the main server configuration area, but are making requests of a VirtualHost (or vice-versa).

If neither of these are the case, please post the relavent sections of your httpd.conf (but please, not all of it! =) ).

raenef

6:20 am on May 8, 2005 (gmt 0)

10+ Year Member



hmmm for some reason they still remain at 0kb

commented out all virtual hosting parts since I never use them anyways.
Heres the logging section of my httpd (not including the commented out sections to reduce size)if you need to see other parts of it let me know:

ErrorLog logs/error.log
CustomLog logs/access.log common

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Subdirectory Logging
SetEnvIf Request_URI "^/ams(/¦$)" ams_request
SetEnvIf Request_URI "^/cataclypse(/¦$)" cataclypse_request

CustomLog logs/ams-requests.log common env=ams_request
CustomLog logs/cataclypse-requests.log common env=cataclypse_request

sitz

8:44 pm on May 9, 2005 (gmt 0)

10+ Year Member



Mmm. This begs the obvious (to the people who've been on this forum for a while, anyway) question; did you use the broken pipe

--> ¦

...or the solid pipe (the solid vertical bar, generally located on the '\' key (one has to hit 'shift' to get it to work).

raenef

4:16 am on May 10, 2005 (gmt 0)

10+ Year Member



:-p I was using the broken pipe, I changed it to the solid pipe and tested it. Now everything works.
Thanks a lot for all your help. :-D Ive racked my brain the past week trying to figure this out.
Thanks again.