Author |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Sat 21 Jul '12 10:53 Post subject: Apache 2.4, SetEnvIf problems with logging. |
|
|
Hi.
I have been trying and trying to make apache 2.2 & 2.4 on Windows_x64 sp1+ with PHP 5.4 not to log local IP actions with (mod_setenvif)
Code: | SetEnvIf Remote_Addr "192\.168\.0\.*" dontlog |
and
Code: | CustomLog combined env=!dontlog |
but in vain, I just keep getting access log entries.. what gives! I'm Using SSL redirectEngine..
Is there some special place where to put this SetEnvIf that is apply? |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Sat 21 Jul '12 11:14 Post subject: |
|
|
An example, how I do it:
CustomLog f:/log/apache/access.log combined env=!no
SetEnvIf Remote_Addr "127\.0\.0\.1" no
SetEnvIf Remote_Addr "192\.168\.0\.1" no
SetEnvIf Request_URI "\.gif$" no
SetEnvIf Request_URI "\.js$" no
SetEnvIf Request_URI "\.jpg$" no
What is a SSL redirectEngine ? |
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Sat 21 Jul '12 11:20 Post subject: |
|
|
Believe me, I have tried all of those, no efect: apache just keeps logging the IP events, i have tried to disclude.
1. Where do you put the SetEnvIF clause? Inside <Directory ?
2. What modules are needed (i have read the API reference of SetEnv).
SSL redirect to me is
Code: | Require all granted
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} |
|
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Sat 21 Jul '12 11:25 Post subject: |
|
|
I believe you
I have it in the main conf, not within a <Directory. |
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Sat 21 Jul '12 11:27 Post subject: |
|
|
can you give me spcific place where you have the SetEnvIf and what modules do you have on.
There has to be something different with
Remote_Addr "127\.0\.0\.1" clause whenn running on Windows 7.. |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Sat 21 Jul '12 11:45 Post subject: |
|
|
In the main conf as I said.
...
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule xml2enc_module modules/mod_xml2enc.so
...
here
...
When Apache is not starting then you do not have the needed modules, so if your Apache is running then all needed modules are loaded.
No diff when running Win7 |
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Sat 21 Jul '12 12:26 Post subject: |
|
|
no, Not working like I want it to. It's still logging xxx.5 even with
Code: | SetEnvIf Remote_Addr "192\.168\.0\.5" no |
Apache has been restarted everytime after config alter.. This is frustrating..
Mod is active
Code: | LoadModule setenvif_module modules/mod_setenvif.so |
I have
Code: | # DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "c:/apac/root"
AccessFileName .htaccess
SetEnvIf Remote_Addr "127\.0\.0\.1" no
SetEnvIf Remote_Addr "192\.168\.0\.5" no
SetEnvIf Remote_Addr "192\.168\.0\.3" no
<Directory "c:/apac/root">... |
and in the
Code: | <IfModule log_config_module>
..CustomLog "logs/access.log" combined env=!no |
|
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Sat 21 Jul '12 13:07 Post subject: |
|
|
Do you see in your log like ?
xxxxx 192.168.0.5 - - [21/Jul/2012:07:17:00 +0200] "GET.....
Should work, maybe someone else can give advise. |
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Sat 21 Jul '12 15:36 Post subject: |
|
|
The logfile states
Code: | 192.168.0.5 - - [21/Jul/2012:13:23:24 +0300] "GET / |
|
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Wed 25 Jul '12 6:23 Post subject: |
|
|
Can anyone provide any suggestion Why SetEnvIf does not work? How Debug-mode can be turned on? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 25 Jul '12 8:42 Post subject: |
|
|
Seems odd, I have this in 2.4 and it works
SetEnvIf Remote_Addr "192.168.0.1" LOCALNET=Yes
SetEnvIf Remote_Host "comp3" LOCALNET=Yes
SetEnvIf Remote_Host "comp7" LOCALNET=Yes
SetEnvIf Remote_Host "comp8" LOCALNET=Yes
CustomLog "logs/access.log" combined env=!LOCALNET
Curious, is mod_setenvif loaded? If not, it's not setting the envvar. You could also see if the envvar is being set looking at phpinfo() or some similar thing in whatever language. |
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Thu 09 Aug '12 20:57 Post subject: |
|
|
Any suggestion on how to fix this? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 09 Aug '12 23:52 Post subject: |
|
|
is there a CustomLog directive in your ssl config? If there is it needs to have env=!no tacked onto the end of it also. |
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Fri 10 Aug '12 9:06 Post subject: |
|
|
Do you mean in the "httpd-ssl.conf" file under extras?
At the end of the file there is CustomLog for ssl_request.log file that is not the basic log as access.log
There is also "TransferLog" line in the config but that points just the access.log file.
SSLOptions +StdEnvVars points to cgi-bin folder. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sat 11 Aug '12 1:57 Post subject: |
|
|
Yes, that was what I meant so ok it's not that |
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Sat 25 Aug '12 20:53 Post subject: |
|
|
Well... No solution? |
|
Back to top |
|
Jurmalauge
Joined: 19 Jul 2012 Posts: 11 Location: finland, helsinki
|
Posted: Sat 08 Sep '12 11:14 Post subject: |
|
|
I had to switch the SSL redirect off in order to make this disclude operation to work.. not good! |
|
Back to top |
|