cyberdyne, feel free to zone out. What follows is an information dump that has nothing directly to do with your question.
with different effects on your logs and their view
Depends where the escapes and/or quotation marks are. I've never managed to do anything within mod_setenvif or mod_rewrite that affected log format. Only the core directives. Someone in another thread came up with a fairly plausible explanation of why this would happen.
I took some time off here to experiment in my art studio's site, which never gets any human visitors so it doesn't matter if I make a mistake that results in 97 more errors than I intended.
Hahaha. Interesting discovery: The quotation marks have no effect on anything except spaces. I tested by locking myself out using a piece of my UA that contains literal spaces, literal periods, literal parentheses-- and a very uncommon browser name.
I can say
Mybrowser/2\.1\.1\ \(like\ Otherbrowser/3\.6\.27\)
or I can say
"Mybrowser/2\.1\.1 \(like Otherbrowser/3\.6\.27\)"
Both work to lock me out, and neither has any effect on logs.
But if I accidentally say
Mybrowser/2\.1\.1\ \(like Otherbrowser/3\.6\.27\)
forgetting to escape one space, I get whapped with a 500 error-- one that's so severe, it can't even display the custom 500 document.
And if I say
"Mybrowser/2\.1\.1 (like Otherbrowser/3\.6\.27)"
trusting the quotation marks to preserve the literal parentheses, it doesn't work. That is, I am not locked out, because mod_rewrite thinks they are capture-parentheses, not part of the string.
Moving on to mod_setenvif, I can escape spaces and say
BrowserMatch Mybrowser/2\.1\.1\ \(like\ Otherbrowser/3\.6\.27\) keep_out
or I can use quotation marks and say
BrowserMatch "Mybrowser/2\.1\.1 \(like Otherbrowser/3\.6\.27\)" keep_out
but if I say
BrowserMatch Mybrowser/2\.1\.1 \(like Otherbrowser/3\.6\.27\) keep_out
... nope, guess again. It does lock me out; it doesn't yield a 500 error.
Hint: You can randomly change anything after the "Mybrowser" part, for example to say Otherbrowser/3\.7\.27 with a different number, and nothing will change. (Matter of fact I'm pretty pleased with how fast I figured this out. Normally I have to throw myself on someone else's mercy for an explanation.)
Finally moving to the core directives. If I change the minor robotic block
Deny from 38.101.148.96/27
to
Deny from 38\.101.148.96/27
I get walloped with another 500 error. It's been hit with two mutually exclusive ways of representing the same numerical range.
If I cut off the /27 and say only
Deny from 38\.101.148.96
...
that's when the logs switch over to resolved-IP mode. Instead of
aa.bbb.ccc.ddd
I am now
adsl-aa-bbb-ccc-ddd.dsl.snfc21.pacbell.net
... but only for the duration of the change. When I set everything back the way it was, logs go back to normal too.