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?
Example:
Sfje93hal=alafjawoifawfpaw849rq3948rawif0834f;
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