Discussion:
[Bug 62936] New: Apache 2.4 does not exclude Request_Method from log using SetEnvIf regex
b***@apache.org
2018-11-21 15:15:36 UTC
Permalink
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: ***@httpd.apache.org
Reporter: ***@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 "Loading Image..." "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 ***@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-***@httpd.apache.org
For additional commands, e-mail: bugs-***@httpd.apache.org
b***@apache.org
2018-11-21 15:34:53 UTC
Permalink
https://bz.apache.org/bugzilla/show_bug.cgi?id=62936

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

What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
Post by b***@apache.org
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-***@httpd.apache.org
For additional commands, e-mail: bugs-***@httpd.apache.org
b***@apache.org
2018-11-21 16:18:20 UTC
Permalink
https://bz.apache.org/bugzilla/show_bug.cgi?id=62936

--- Comment #2 from Serge <***@gmail.com> ---
(In reply to Eric Covener from comment #1)
Post by b***@apache.org
Post by b***@apache.org
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-***@httpd.apache.org
For additional commands, e-mail: bugs-***@httpd.apache.org
b***@apache.org
2018-11-21 22:12:35 UTC
Permalink
https://bz.apache.org/bugzilla/show_bug.cgi?id=62936

--- Comment #3 from Eric Covener <***@gmail.com> ---
(In reply to Serge from comment #2)
Post by b***@apache.org
(In reply to Eric Covener from comment #1)
Post by b***@apache.org
Post by b***@apache.org
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-***@httpd.apache.org
For additional commands, e-mail: bugs-***@httpd.apache.org
Loading...