- Optional: Create a suricata.yaml in the test directory.
- Note: You may want to add something like:
- ```
- include: ../../etc/suricata-4.0.3.yaml
- ```
- to the top and then just make the necessary overrides in the tests
- suricata.yaml.
+ Its usually OK to just add the bits of YAML required to enable
+ features for the test.
If the test directory does not include a suricata.yaml, the one
found in your build directory will be used.
# Example match on array item:
alert.metadata.tag[0]: "tag1"
+
+ # Example match on the length of an array.
+ alert.metadata.tag.__len: 3
# Check that a field exists:
has-key: alert.rule
"""
parts = name.split(".")
for part in parts:
+
+ if part == "__len":
+ # Get the length of the object. Return -1 if the object is
+ # not a type that has a length (numbers).
+ try:
+ return len(obj)
+ except:
+ return -1
+
name = None
index = None
m = re.match("^(.*)\[(\d+)\]$", part)