httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <cove...@gmail.com>
Subject Re: [users@httpd] Make logging decision using two environment variables
Date Mon, 13 Oct 2014 18:29:48 GMT
On Mon, Oct 13, 2014 at 2:11 PM, Truesdell Douglas A <
TruesdellDouglasA@johndeere.com> wrote:

>  I am trying to add replace the address field in a log when there is an
> X-Forwarded-For header following the notes in
> http://www.techstacks.com/howto/log-client-ip-and-xforwardedfor-ip-in-apache.html.
> This reference shows how to create and use the necessary condition on the
> CustomLog directive. But in my case the CustomLog directive has a
> pre-existing environment variable selecting for it. So I am now wanting to
> select the CustomLog based on two environment variables. The logic would
> say “Log using a given format if ${A} and ${B}”.
>
>
>
> The syntax for CustomLog supports a single “env” directive only. In
> addition, it appears that SetEnv can create a variable based only on a
> single property. Finally, “If” directives cannot use declared environment
> variables (since the If is evaluated before a declared variable is
> evaluated). So there seems to be no way to construct a logging decision in
> the form “A and B” using these tools. Is there some way to do this?
>

​What sets your existing environment variable?​  If you currently use
SetEnv, you could move to SetEnvIf and have it set earlier. This would
allow you to use an expression in <if> that puts both variables in a string
and compares the concatenated value.



-- 
Eric Covener
covener@gmail.com

Mime
View raw message