Welcome to WebmasterWorld Guest from 23.22.220.37

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Log file problem

     
8:30 pm on Jan 2, 2013 (gmt 0)

New User

joined:July 16, 2012
posts:8
votes: 0


I'm currently using "SetEnvIf Request_URI "blahblah" dontlog" for simple requests, however I have more complex requests I'm having troubles filtering.

GET /p/index.html?cmd=thumb&sfpg=MjAwNS8wOS8qMDAwXzA0NzYuanBnKjU3ZjMyMjc0NDg5YTdiMTVhM2RkNWE4NWI4ZWZjYWYw
GET /p/index.html?cmd=photo&sfpg=MjAwNS8wOS8qMDAwXzA0NzYuanBnKjU3ZjMyMjc0NDg5YTdiMTVhM2RkNWE4NWI4ZWZjYWYw

I would like to filter out just the requests with "cmd=thumb", but i can't quite figure out how to do it. Please help me out here. Thank you.
9:40 pm on Jan 2, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12702
votes: 244


Does Query_String work? Apache cops out by pointing you from mod_setenvif to mod_rewrite, but that seems to be what they're saying. And if that's not what they're saying, you can use mod_rewrite itself to set an environmental variable (flag [E=something] or [E=something:value]) and take it from there.
1:19 am on Jan 3, 2013 (gmt 0)

New User

joined:July 16, 2012
posts:8
votes: 0


I'm so confused by what you said. I am pretty n00bish to this. All I'm trying to do is get the requests that contain "cmd=thumb" to not show up in my access log.
10:38 pm on Jan 3, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12702
votes: 244


The "cmd=thumb" element is in the query string, not in the body of the URL, so you have to use different wording.

You're currently using
SetEnvIf Request_URI

so I wondered if
SetEnvIf Query_String

would work. Can't test it myself because I don't use query strings except internally, but someone should know.

:: looking vaguely around for g1 or someone like him ::

And if you can't do this with mod_setenvif, the alternative way using mod_rewrite should be straightforward.
It may help to remember that the environmental variable by itself (in this case "dontlog") doesn't do anything. It's just a way of carrying a message.
11:36 am on Jan 4, 2013 (gmt 0)

New User

joined:July 16, 2012
posts:8
votes: 0


I couldn't get the SetEnvIf Query_String idea to work.

I did try this, but it got me nowhere:

RewriteCond %{QUERY_STRING} ^cmd=thumb$
RewriteRule (.*) $1 [E=dontlog:yes]
5:59 pm on Jan 4, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12702
votes: 244


Is "cmd=thumb" the only thing in the query string? If not, the ^ $ anchors will prevent it from working.
7:15 pm on Jan 4, 2013 (gmt 0)

New User

joined:July 16, 2012
posts:8
votes: 0


I took the two anchors off and it works. Thank you so much!
9:43 pm on Jan 4, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10542
votes: 8


welcome to WebmasterWorld, PremiumSaltine!