Hi,
I’m pretty new to this pipeline thing but I’m seeing something that makes no sense to me, and I’d appreciate a little feedback.
Problem description:
TL;DR: A pipeline that enriches exim4 loglines matches rules and starts to process, but accessing a regex match set seems to result in some sort of abort, with lost messages as a result. Matching the rule in the simulator works just fine and shows no errors.
What I’m trying to parse:
2021-01-17 14:52:44 1l19Pz-0006T2-PI <= florian@senderdomain.tld H=84-245-8-134.dsl.random.hostname.tld (clevo) [12.16.153.14] P=smtp S=671
Pipeline rule (edited to show preformatted now):
rule "exim: ingress message"
when
// Select for incoming SMTP connections
has_field("message") AND contains(to_string($message.message)," <= ")
then
// mark message as incoming
set_field("eximsg_state","ingress");
// identify sender email
let sar = regex(".* <= (\\S{1,}@\\S{2,}\\.\\S{2,})", to_string($message.message));
let sender = to_string(sar["0"]);
set_field("eximsg_sender", sender);
end
If I throw this line at the Simulator it evaluates fine and the expected fields are added, and eximsg_sender does contain “florian@senderdomain.tld”
If I run this same scenario ‘live’ the entire message seems to get lost in the pipeline, actually searching for the message ID (‘1l19Pz-0006T2-PI’ in this example) yields no results for this log-line, but others in the same transaction do appear.
Uncommenting the line ‘set_field(“eximsg_sender”, sender);’ makes the message appear in the stream again, but then obviously the eximsg_sender field does not appear.
What I’ve tried
The problem seems to occur when I try to address the match set as an array. If I fill the field without the [“0”] suffix the field is populated with a json-like array "{“0”:“florian@senderdomain.tld”}. This leads me to believe there is something wrong with the way I’m accessing the match set.
BTW, I’ve found a similar approach in Issue with regex-array in pipeline-rule so this is why I’ve formulated it this way.
The setup
Is basically a docker stack with
- Graylog 4.0.1
- Elastic 7.10.0
Any hints or pointers are much appreciated.
Regards,
F.