4

I have 2 CustomLog statements:

# SVN-ACTION is default env
CustomLog logs/svn_access_log common env=SVN-ACTION
SetEnvIf Request_Method GET GET-ACTION
CustomLog logs/get_access_log common env=GET-ACTION

That works, but the CustomLog statement below doesn't work... it prints an error:

CustomLog logs/ssl_access_log common env=!GET-ACTION env=!SVN-ACTION

How can I use multiple env conditions in CustomLog?

Somputer
  • 141
  • 1
  • 2

2 Answers2

2

use this:

CustomLog logs/ssl_access_log common \ "expr=(-z reqenv('GET-ACTION') && -z reqenv('SVN_ACTION'))"

the whole third argument seems to need double quotes. quoting right-side of "=" only is not enough.

syntax tested with version 2.4.34.

1

In Apache 2.4 you can use an expression.

For example:

CustomLog logs/ssl_access_log common \
  "expr=-z reqenv('GET-ACTION') && -z reqenv('SVN_ACTION')"
Nathan
  • 43
  • 7
Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
  • It doesn't work... error message is "CustomLog takes two or three arguments, a file name, a custom log format string or format name, and an optional "env=" or "expr=" clause (see docs)" – Somputer Jan 26 '18 at 04:56
  • @Nathan thanks for the edit, which I think addresses Somputer's comment. – Andrew Schulman Apr 13 '21 at 12:19