Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

add remove_from_default boolean option to route_to_stream function #220

Merged
merged 2 commits into from Oct 19, 2017

Conversation

kroepke
Copy link
Member

@kroepke kroepke commented Oct 19, 2017

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 use drop_message for that purpose.

fixes #117

this allows remove messages from the default stream like the stream router already does
@kroepke kroepke added this to the 3.0.0 milestone Oct 19, 2017
@ghost ghost assigned kroepke Oct 19, 2017
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;
Copy link
Contributor

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()) {
Copy link
Contributor

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?

Copy link
Member Author

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.

@joschi joschi merged commit 03958fe into master Oct 19, 2017
@joschi
Copy link
Contributor

joschi commented Oct 19, 2017

@kroepke Please adapt the functions documentation in https://github.com/Graylog2/documentation/ accordingly.

@joschi joschi deleted the issue-117 branch October 19, 2017 15:47
joschi pushed a commit that referenced this pull request Oct 19, 2017
* 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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove_from_stream function missing
2 participants