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?

2
  • You tagged your question as apache-2.2 and apache-2.4. Which is it? The answer depends on which Apache version you're using. Jan 26, 2018 at 3:15
  • I remove apache-2.2 tag
    – Somputer
    Jan 26, 2018 at 4:53

2 Answers 2

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')"
2
  • 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, 2018 at 4:56
  • @Nathan thanks for the edit, which I think addresses Somputer's comment. Apr 13, 2021 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .