# Clone plugin documentation wrong or a bug?

**URL:** https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156
**Category:** Logstash
**Created:** [July 30, 2018, 11:12am UTC](https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156 "2018-07-30T11:12:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dennis300481](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dennis300481](https://discuss.elastic.co/u/dennis300481)
#### Post date: [July 30, 2018, 11:12am UTC](https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156/1 "2018-07-30T11:12:36Z")

</div>

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](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?

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [July 30, 2018, 1:27pm UTC](https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156/2 "2018-07-30T13:27:43Z")

</div>

Looking at the [code](https://github.com/logstash-plugins/logstash-filter-clone/blob/master/lib/logstash/filters/clone.rb#L25), 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.

---

<div class="post-metadata">

### Author: ![dennis300481](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dennis300481](https://discuss.elastic.co/u/dennis300481)
#### Post date: [August 2, 2018, 7:25am UTC](https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156/3 "2018-08-02T07:25:22Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [August 2, 2018, 1:45pm UTC](https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156/4 "2018-08-02T13:45:36Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![dennis300481](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dennis300481](https://discuss.elastic.co/u/dennis300481)
#### Post date: [August 27, 2018, 9:11am UTC](https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156/5 "2018-08-27T09:11:16Z")

</div>

Hi Badger,

sorry for late answering, i was busy the last weeks.  
I've opened an [issue](https://github.com/logstash-plugins/logstash-filter-clone/issues/14)  
Let's see what happens 😉

Dennis

---

<div class="post-metadata">

### Author: ![dennis300481](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dennis300481](https://discuss.elastic.co/u/dennis300481)
#### Post date: [August 30, 2018, 10:56am UTC](https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156/6 "2018-08-30T10:56:00Z")

</div>

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

> <https://github.com/logstash-plugins/logstash-filter-clone/pull/15>

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 27, 2018, 10:56am UTC](https://discuss.elastic.co/t/clone-plugin-documentation-wrong-or-a-bug/142156/7 "2018-09-27T10:56:04Z")

</div>

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