Clone plugin documentation wrong or a bug?

I was trying to use the following config:
filter {
clone {
add_tag => [ "cloned" ]
}
}

This is not doing what i expect. My expectation is, that this will clone the current event
and the cloned one has a tag "cloned". But, there is no event clone and also
no info/warning/error log output.

The following config is doing the right:
filter {
clone {
clones => ["cloned" ]
add_tag => [ "cloned" ]
}
}

The difference is an additional option "clones".
In the documentation (https://www.elastic.co/guide/en/logstash/6.3/plugins-filters-clone.html#plugins-filters-clone-common-options)
the option "clones" is described as not required.

Should this documentation be updated or is it a bug?

Looking at the code, it is clearly working as intended. It iterates over the values in the clones array and clones for each one. If there are no values then you get no clones. The documentation could be more explicit on that.

Badger, thanks for looking at that!

From my point of view it would make sense
to through an exception, if the clones-array has a zero length.
And yes, the documentation should be more explicit and
should mark this option as required.

Because otherwise, the plugin usage would make no sense and the problem is,
that the user don't get any hint, that this plugin is doing nothing.

Do you agree and should i open an issue on GitHub?

Dennis

Strictly speaking the option is not required. The plugin will not raise an exception if it is not supplied. The plugin is a no-op if it is not supplied and it might be helpful for the documentation to explicitly state that. You can try raising an issue. Sometimes I get a good result from that, sometimes not :slight_smile:

Hi Badger,

sorry for late answering, i was busy the last weeks.
I've opened an issue
Let's see what happens :wink:

Dennis

FYI: João added a warning that an empty clones is a no-op. Nice solution. :slight_smile:

1 Like

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