Understanding Filter AND & OR condition
@Qmando
I would like to understand the difference between these two conditions. Both the rules responses in a different way.
What I notice is in Rule 1 the term "RT_FLOW_SESSION_DENY" is not matched, but in Rule 2 it matches all the condition including RT_FLOW_SESSION_DENY
Only difference between two rules are I used OR condition in the second part of RULE 1
Rule 1
filter:
- and:
- term:
srx-rt-flow: "RT_FLOW_SESSION_DENY"
- term:
srx-policy-name: "default-deny"
filter:
- or:
- not:
terms:
srx-source-zone-name: ["Internet", "EXTERNAL", "Safe-Zone"]
- not:
terms:
srx-source-address: ["10.18.109.59", "10.10.10.10", "20.20.20.20", "30.30.30.30"]
Rule 2
filter:
- and:
- term:
srx-rt-flow: "RT_FLOW_SESSION_DENY"
- term:
srx-policy-name: "default-deny"
filter:
- and:
- not:
terms:
srx-source-zone-name: ["Internet", "EXTERNAL", "Safe-Zone"]
- not:
terms:
srx-source-address: ["10.18.109.59", "10.10.10.10", "20.20.20.20", "30.30.30.30"]
@Qmando
Correct me if I'm wrong the below condition means it should match both the term field (value, something) because of the embedded AND ?
filter:
- and:
- not:
term:
field: "value"
- not:
term:
_type: "something"
The AND is redundant. Everything under filter is implicitly joined with an AND
filter:
- and:
- not:
term:
field: "value"
- not:
term:
_type: "something"
is exactly the same as
filter:
- not:
term:
field: "value"
- not:
term:
_type: "something"
above the filter which rule type to do use ????
@cssharavanan
filters apply to every rule type.