Creating Pipepline Rule Based on Time And Message Contents

I am trying to create an alert that only goes off between 6AM and 6PM and am trying to create a pipeline to facilitate this.

I want to evaluate if the full message field contains the text “ACCUM_CLAIM_HOLD_PROD1” between 6AM and 6PM and if it does add the field “can_alert”.

The field gets added with the following code.

rule "Alert When Accumulation Service Stops"
when
has_field("full_message") AND to_bool(regex("ACCUM_CLAIM_HOLD_PROD1",to_string($message.full_message)).matches)
then
set_field("can_alert", true);
end

When I add on what I think is needed to evaluate the time I just get an error complaining about “Incompatible types”.

rule "Alert When Accumulation Service Stops"
when
has_field("full_message") AND to_bool(regex("ACCUM_CLAIM_HOLD_PROD1",to_string($message.full_message)).matches)AND (to_date($message.EventReceivedTime).hourOfDay >= 6 AND to_date($message.EventReceivedTime).hourOfDay <= 18)
then
set_field("can_alert", true);
end

I was hoping I could get some guidance on what I am missing.

In your snippet in the post there is no space between the “)” and the “AND” after the regex function. Not sure if that is a copy paste error or if that is actually a mistake that exists in the attempt to write the pipeline.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.