# Help with Split Filter

**URL:** https://discuss.elastic.co/t/help-with-split-filter/275339
**Category:** Logstash
**Created:** [June 8, 2021, 6:41pm UTC](https://discuss.elastic.co/t/help-with-split-filter/275339 "2021-06-08T18:41:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![pvxchain](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@pvxchain](https://discuss.elastic.co/u/pvxchain)
#### Post date: [June 8, 2021, 6:41pm UTC](https://discuss.elastic.co/t/help-with-split-filter/275339/1 "2021-06-08T18:41:36Z")

</div>

Hello

I'm trying to create two events out of one so that the subsequent pipeline takes place in both.

The event itself, before the split happens here:

```auto
filter {
   if [type] == "pre-split" {
     mutate {
       replace => {"value_1" => "value_1_pre"}
       replace => {"value_2" => "value_2_pre"}
       replace => {"value_3" => "value_3_pre"}
       replace => {"value_4" => "value_4_pre"}
     }
   }
}

```

My idea is to separate this event into two, the first with the values 1 and 2 and the second with the values 3 and 4.

It is not clear to me if what I want is possible or if it is with the split filter that I have to do it.

I'm a bit stuck on this topic and a little help would be great for me. Thanks in advance!

---

<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: [June 8, 2021, 7:01pm UTC](https://discuss.elastic.co/t/help-with-split-filter/275339/2 "2021-06-08T19:01:49Z")

</div>

A split filter is used to take each entry in an array and create an event for it. (It can also split a delimited string into an array and then do the same.)

I think what you want is a clone filter.

```
clone { clones => ["theClone"] }
if [type] == "theClone" {
    # Do one thing
} else {
    # Do another
}
```

---

<div class="post-metadata">

### Author: ![pvxchain](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@pvxchain](https://discuss.elastic.co/u/pvxchain)
#### Post date: [June 8, 2021, 8:53pm UTC](https://discuss.elastic.co/t/help-with-split-filter/275339/3 "2021-06-08T20:53:20Z")

</div>

Thanks @Badger !

So the idea would be something like this?

```auto
filter {
   
   if [type] == "pre-split" {
        
        mutate {
        replace => {"value_1" => "value_1_pre"}
        replace => {"value_2" => "value_2_pre"}
        replace => {"value_3" => "value_3_pre"}
        replace => {"value_4" => "value_4_pre"}
        }

        clone { clones => ["value12"] }

        if [type] == "value12" {
            mutate { remove_field => ["value_3_pre","value_4_pre"] }
        } else {
            mutate { type => "value34" }
            mutate { remove_field => ["value_1_pre","value_2_pre"] ​}
        }
    }
}

```

So I understand that the two "events" that have been generated from the original will be processed separately as shown in the following image?

I have made this drawing (sorry for my lack of artistics) that I don't know if it would help to understand what I want to do:

 ![clone_pipeline](https://us1.discourse-cdn.com/elastic/original/3X/b/b/bb7c7bb6a680bc89068fa06b218e3c56dfd0f6f3.png)

---

<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: [June 8, 2021, 8:59pm UTC](https://discuss.elastic.co/t/help-with-split-filter/275339/4 "2021-06-08T20:59:08Z")

</div>

> [@pvxchain](#):
>
> So the idea would be something like this?

That looks right.

---

<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: [July 6, 2021, 8:59pm UTC](https://discuss.elastic.co/t/help-with-split-filter/275339/5 "2021-07-06T20:59:47Z")

</div>

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