Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Conditional Logging on more than one constraint

$
0
0
Hi,

So the conditional logging example on nginx website is this, which I've tried, and it works as advertised.

-----------
map $status $loggable {
~^[23] 0;
default 1;
}

access_log /path/to/access.log combined if=$loggable;[/quote]
-----------

What happens if I also want to stop logging for clients with the User Agent "Zabbix"? If I try this ...

-----------------
map $status $loggable {
~^[23] 0;
default 1;
}

map $http_user_agent $loggable {
Zabbix 0;
default 1;
}

access_log /path/to/access.log combined if=$loggable;
---------------

... then the first map is superceded by the second, i.e. the $status is ignored and only the $http_user_agent is used to decide what is logged.

Whats the trick for setting $loggable=0 for both cases?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>