You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2018/11/21 15:15:36 UTC

[Bug 62936] New: Apache 2.4 does not exclude Request_Method from log using SetEnvIf regex

https://bz.apache.org/bugzilla/show_bug.cgi?id=62936

            Bug ID: 62936
           Summary: Apache 2.4 does not exclude Request_Method from log
                    using SetEnvIf regex
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_setenvif
          Assignee: bugs@httpd.apache.org
          Reporter: altertag2013@gmail.com
  Target Milestone: ---

Hello to Apache,

Environment
CentOS 7.5
Server version: Apache/2.4.6 (CentOS) installed from CentOS base repository
using yum
LogFormat "%h %l %u %t \"%m %V%U %H\" %>s %b \"%{Referer}i\"
\"%{User-agent}i\"" combined
CustomLog /var/log/httpd/access_log combined env=!dontlog

Problem description
EXAMPLE 1 - OK 
SetEnvIf Request_URI "\.png$|\.gif$|\.jpg$|\.jpeg$|\.js$|\.css|\.woff$" dontlog
everything is ok, it excludes from Apache log the lines like 
83.266.84.27 - - [27/Oct/2018:14:07:19 -0500] "GET example.com/mod/maxtop.php
HTTP/1.1" 200 3412 "http://example.com/image.png" "Mozilla/5.0 (Windows NT
10.0; rv:56.0) Gecko/20100101 Firefox/56.0"

EXAMPLE 2 - PROBLEM
SetEnvIf Request_Method "GET(.*)/maxtop\.php$" dontlog
does NOT exclude from Apache log the lines like
83.266.84.27 - - [27/Oct/2018:14:07:19 -0500] "GET example.com/mod/maxtop.php
HTTP/1.1" 200 3412 "http://example.com/page218.html" "Mozilla/5.0 (Windows NT
10.0; rv:56.0) Gecko/20100101 Firefox/56.0"

I tried many other variations, for example
SetEnvIf Request_Method "\.php$" dontlog
but it does not work - anyway Apache does NOT exclude the according lines from
log file.

I asked StackOverflow
https://stackoverflow.com/questions/53025708/apache-2-4-how-to-exclude-certain-get-requests-from-log-using-setenvif
but nobody can't answer there.

I did not find in Google no one REAL example how to do that.
A week ago I asked same from users@httpd.apache.org - but also nobody answered
me.

Please, cross-check from your side - is this a bug of Apache 2.4 or
mod_setenvif ?
Why 
SetEnvIf Request_URI "\.png$|\.gif$|\.jpg$|\.jpeg$|\.js$|\.css|\.woff$" dontlog
- WORKS OK
but same
SetEnvIf Request_Method "\.php$" dontlog - DOES NOT WORK ?

Thanks in advance for attention and answer.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62936] Apache 2.4 does not exclude Request_Method from log using SetEnvIf regex

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62936

--- Comment #2 from Serge <al...@gmail.com> ---
(In reply to Eric Covener from comment #1)
> > Request_Method "GET(.*)/maxtop\.php$"
> 
> This will never match, Request_Method is something like "GET" alone.

Do you mean we can only exclude ALL GET requests but not certain GET requests
by regex like
SetEnvIf Request_Method "\.php$" dontlog
?
Please, comment precisely to understand the issue finally, otherwise the
question should be REOPENED.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62936] Apache 2.4 does not exclude Request_Method from log using SetEnvIf regex

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62936

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Eric Covener <co...@gmail.com> ---
> Request_Method "GET(.*)/maxtop\.php$"

This will never match, Request_Method is something like "GET" alone.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62936] Apache 2.4 does not exclude Request_Method from log using SetEnvIf regex

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62936

--- Comment #3 from Eric Covener <co...@gmail.com> ---
(In reply to Serge from comment #2)
> (In reply to Eric Covener from comment #1)
> > > Request_Method "GET(.*)/maxtop\.php$"
> > 
> > This will never match, Request_Method is something like "GET" alone.
> 
> Do you mean we can only exclude ALL GET requests but not certain GET
> requests by regex like
> SetEnvIf Request_Method "\.php$" dontlog
> ?
> Please, comment precisely to understand the issue finally, otherwise the
> question should be REOPENED.

You have to read the names of the parameters, Request_method has nothing to do
with a URL.

The manual is pretty clear:
https://httpd.apache.org/docs/2.4/mod/mod_setenvif.html#setenvif
Request_Method - the name of the method being used (GET, POST, et cetera)

If you want to compare against the method and the URL at the same time, you'll
have to use something more sophisticated like SetEnvIfExpr or <If>

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org