This is a discussion on CustomLog Problem within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello. I am attempting to create a second log file for accesses to a specific directory or URL in my ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello.
I am attempting to create a second log file for accesses to a specific directory or URL in my domain. Here is the log section of my config: SetEnvif Request_URI "/community" community SetEnvIf Remote_Addr "192\.168\.1\.1" dontlog SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog setEnvif Remote_Addr "150\.94\.6\.40" dontlog SetEnvif Remote_Addr "150\.94\.46\.178" dontlog CustomLog logs/community.log combined env=community CustomLog logs/access.log combined env=!dontlog CustomLog logs/access.log combined env=!community These statements are intended to accomlish two things: 1. Don't log anything to either log that match the four IP addresses specified. 2. Log everything to access.log except requests to www.domain.com/community. Log those requests to community.log The IP logging exceptions work fine. The four IP addresses are not logged to either log. The directory exception does not work as expected. With these statements requests to www.domain.com/community are written to BOTH access.log and community.log at the same time. Does anyone have an idea as to why this statement: CustomLog logs/access.log combined env=!community does not prevent the server from logging reqeusts to www.domain.com/community to access.log? My goal is to log all requests to access.log with the exception of those intended for/community. Those requests should go to communty.log. Thanks. Laura |
|
|||
|
"Laura Anderson" <laura66a@yahoo.com> schreef in bericht
news:fi4am2tuslekqh5l97kr1delbl7u82d26s@4ax.com... > SetEnvif Request_URI "/community" community > SetEnvIf Remote_Addr "192\.168\.1\.1" dontlog > SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog > setEnvif Remote_Addr "150\.94\.6\.40" dontlog > SetEnvif Remote_Addr "150\.94\.46\.178" dontlog > CustomLog logs/community.log combined env=community > CustomLog logs/access.log combined env=!dontlog > CustomLog logs/access.log combined env=!community > > The IP logging exceptions work fine. The four IP addresses are > not logged to either log. Please check again carefully... For such behaviour, I'ld expect lines like SetEnvIf Remote_Addr "192\.168\.1\.1" dontlog !community > The directory exception does not work as expected. With these > statements requests to www.domain.com/community are written to > BOTH access.log and community.log at the same time. I gather for the given IPs it's only logged to community.log > Does anyone have an idea as to why this statement: > CustomLog logs/access.log combined env=!community > does not prevent the server from logging reqeusts to > www.domain.com/community to access.log? It most likely DOES, but logging is then done by CustomLog logs/access.log combined env=!dontlog Test for me SetEnvif Request_URI "/community" community dontlog SetEnvIf Remote_Addr "192\.168\.1\.1" dontlog !community SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog !community setEnvif Remote_Addr "150\.94\.6\.40" dontlog !community SetEnvif Remote_Addr "150\.94\.46\.178" dontlog !community CustomLog logs/community.log combined env=community CustomLog logs/access.log combined env=!dontlog HansH |
|
|||
|
This setup /could/ be made to work, but if you need to start doing this
for another dir, things get more and more complicated, how about just logging to a single file as suggested by the kind folks at Apache (# file descriptiors), and then using a script to post analyse it. here's how windows would create two separate logs files from your master: findstr /V "\/community" access.log > everything_but_community.log findstr "\/community" access.log > community.log they are instantaneous even on a log file of 100MB on an old P3. similar easy scripts can be made to work on flavours of nix/linux |
|
|||
|
Hans, thank you for your reply.
The sequence you posted works perfectly! I suspected it had something to do with the dontlog process, but there wasn't enough information in the Apache documentation to figure it out. Laura On Thu, 23 Nov 2006 09:08:56 +0100, "HansH" <hans@niet.op.het.net> wrote: >"Laura Anderson" <laura66a@yahoo.com> schreef in bericht >news:fi4am2tuslekqh5l97kr1delbl7u82d26s@4ax.com.. . >> SetEnvif Request_URI "/community" community >> SetEnvIf Remote_Addr "192\.168\.1\.1" dontlog >> SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog >> setEnvif Remote_Addr "150\.94\.6\.40" dontlog >> SetEnvif Remote_Addr "150\.94\.46\.178" dontlog >> CustomLog logs/community.log combined env=community >> CustomLog logs/access.log combined env=!dontlog >> CustomLog logs/access.log combined env=!community >> >> The IP logging exceptions work fine. The four IP addresses are >> not logged to either log. >Please check again carefully... >For such behaviour, I'ld expect lines like >SetEnvIf Remote_Addr "192\.168\.1\.1" dontlog !community > >> The directory exception does not work as expected. With these >> statements requests to www.domain.com/community are written to >> BOTH access.log and community.log at the same time. >I gather for the given IPs it's only logged to community.log > >> Does anyone have an idea as to why this statement: >> CustomLog logs/access.log combined env=!community >> does not prevent the server from logging reqeusts to >> www.domain.com/community to access.log? > >It most likely DOES, but logging is then done by >CustomLog logs/access.log combined env=!dontlog > >Test for me > SetEnvif Request_URI "/community" community dontlog > SetEnvIf Remote_Addr "192\.168\.1\.1" dontlog !community > SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog !community > setEnvif Remote_Addr "150\.94\.6\.40" dontlog !community > SetEnvif Remote_Addr "150\.94\.46\.178" dontlog !community > CustomLog logs/community.log combined env=community > CustomLog logs/access.log combined env=!dontlog > >HansH > |
|
|||
|
Matt, thanks for your reply.
This is good information to hang on to. The findstr windows command is something i looked at for this. While it really does work well, in the long run it is harder to create and manage log files this way when statistics are being compiled once an hour. My web server is not having any problem writing to two or even three separate logs at once. With that working, I can use the findstr command to be able to compile special circumstance statistics that the web server does not distinguish on a routine basis. Laura On 23 Nov 2006 01:34:43 -0800, "shimmyshack" <matt.farey@gmail.com> wrote: >This setup /could/ be made to work, but if you need to start doing this >for another dir, things get more and more complicated, how about just >logging to a single file as suggested by the kind folks at Apache (# >file descriptiors), and then using a script to post analyse it. >here's how windows would create two separate logs files from your >master: > >findstr /V "\/community" access.log > everything_but_community.log >findstr "\/community" access.log > community.log > >they are instantaneous even on a log file of 100MB on an old P3. > >similar easy scripts can be made to work on flavours of nix/linux |