add remove_from_default boolean option to route_to_stream function #220
Conversation
this allows remove messages from the default stream like the stream router already does
this function removes the function from the given streams (via name or id) if the message would be taken off all streams, it is routed back to the default stream to avoid dropping the message accidentally
@@ -46,8 +46,6 @@ | |||
import org.graylog.plugins.pipelineprocessor.functions.encoding.Base32Encode; | |||
import org.graylog.plugins.pipelineprocessor.functions.encoding.Base32HumanDecode; | |||
import org.graylog.plugins.pipelineprocessor.functions.encoding.Base32HumanEncode; | |||
import org.graylog.plugins.pipelineprocessor.functions.encoding.Base64Decode; | |||
import org.graylog.plugins.pipelineprocessor.functions.encoding.Base64Encode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh, that's not a good sign.
That means someone forgot to add these functions…
Refs #190
} | ||
final Message message = messageParam.optional(args, context).orElse(context.currentMessage()); | ||
streams.forEach(stream -> { | ||
if (!stream.isPaused()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it important whether a stream is paused or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not particularly, but paused streams aren't taken into account when adding either.
Actually more of a cargo cult copy'n'waste artifact from the route_to_stream
function and the StreamRouter
.
@kroepke Please adapt the functions documentation in https://github.com/Graylog2/documentation/ accordingly. |
* Add `remove_from_default` boolean option to `route_to_stream()` function This allows remove messages from the default stream like the stream router already does * Add `remove_from_stream()` function This function removes the function from the given streams (via name or id) if the message would be taken off all streams, it is routed back to the default stream to avoid dropping the message accidentally (cherry picked from commit 03958fe)
this allows remove messages from the default stream like the stream router already does
with the
remove_from_stream
function any arbitrary stream can be removed. it always makes sure that the message is at least on the default stream. dropping messages this way is not supported, the user must usedrop_message
for that purpose.fixes #117