Re: Make logging decision using two environment variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Mon, Oct 13, 2014 at 2:11 PM, Truesdell Douglas A <TruesdellDouglasA@xxxxxxxxxxxxx> 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@xxxxxxxxx

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux