I am trying my hand at pipeline processing, but once again it just confuses me and I get nowhere with it!
So below I will include sudo code of what I am trying to achieve:
If
field: TargetUserName exists
then
if
field: TargetUserName matches regex: "\\$$" (This regex matches field values that end with $)
then
set field name: TargetUserName to TargetWorkstationName
end
Could you provide me with the code to match the field ‘TargetUserName’ with the regex \$$
I really struggle to understand the syntax behind the pipeline processors, and usually choose to not use them where possible. I have read multiple forum posts and all of the documentation surrounding them, however I still can’t seem to get them working, to a point where it’s worth it over using streams and extractors to solve issues I have.
I have been pointed to this page before, I still don’t understand it. I’m not sure if this is just me or if other users struggle with pipeline processing. Looking at that page, I don’t understand what each line is doing I feel that it could be more clearly documented.
rule "a_rule"
when
has_field("a_field") AND to_bool(regex("^0$",to_string($message.somefield)).matches)
then
//do whatever you want here
remove_field("another_field");
end
I think another way is to do this step by step in pipeline eg.
step 0 contains the field
step 1 matches regex + change name (only if step one passes)