Greetings:
I am attempting to create a pipeline rule(s) to provide notice when an international user is working outside of their normal hours. Here is my attempt:
rule "!Between 6 PM and 7 AM_Management"
when
has_field("UserId") &&
(
to_string($message.UserId) == "user@foo.bar" ||
to_string($message.UserId) == "user2@foo.bar"
) &&
!(to_long(to_date($message.timestamp, "Asia/Yangon").hourOfDay) >= 7 AND
to_long(to_date($message.timestamp, "Asia/Yangon").hourOfDay) <= 19)
then
set_field("Outside_WorkHours", false);
end
and
rule "Between 6 PM and 7 AM_Management"
when
has_field("UserId") &&
(
to_string($message.UserId) == "user@foo.bar" ||
to_string($message.UserId) == "user2@foo.bar"
) &&
(to_long(to_date($message.timestamp, "Asia/Yangon").hourOfDay) >= 7 AND
to_long(to_date($message.timestamp, "Asia/Yangon").hourOfDay) <= 19)
then
set_field("Outside_WorkHours", true);
end
The pipeline is then compares messages against these two rules in a pipeline stage with a “none or more” delimiter as there are other users that I am not monitoring.
This should work, yes (but its not).
Also, I can’t seem to make a rule that does TimeZone modification. I just want a rule to convert timestamp to Asia/Yangon for a new field and nothing seems to work. Anyone have a working example?
Thank you!