CustomLog Problem

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 ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-23-2006
Laura Anderson
 
Posts: n/a
Default CustomLog Problem

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
  #2 (permalink)  
Old 11-23-2006
HansH
 
Posts: n/a
Default Re: CustomLog Problem

"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


  #3 (permalink)  
Old 11-23-2006
shimmyshack
 
Posts: n/a
Default Re: CustomLog Problem

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

  #4 (permalink)  
Old 11-24-2006
Laura Anderson
 
Posts: n/a
Default Re: CustomLog Problem

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
>

  #5 (permalink)  
Old 11-24-2006
Laura Anderson
 
Posts: n/a
Default Re: CustomLog Problem

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:45 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0