I have a proxy that is inserting several cookies into each request that all match the same regex pattern and I’d like to use a pipeline rule to turn them all into fields.
There can be 1-4 of these cookies in each request.
How do I get the rule to match multiple occurrences of a pattern and put each one into a different field?
Current rule that is working to match first occurrence:
rule “extract cookies”
when
has_field(“application_name”)
then
let rawmsg = to_string($message.message);
let result = regex("(AS\w{8}=\w+;)", rawmsg);
set_field(“cookie1”, result[“0”]);
end
rule “extract cookies”
when
has_field(“application_name”)
then
let rawmsg = to_string($message.message);
let result = regex("(AS\w{8}=\w+;)", rawmsg);
set_field(“cookie1”, result[“0”]);
set_field(“cookie2”, result[“1”]);
set_field(“cookie3”, result[“2”]);
set_field(“cookie4”, result[“3”]);
end
```