# How can I find some designated value after using split

**URL:** <https://discuss.elastic.co/t/how-can-i-find-some-designated-value-after-using-split/237907>\
**Category:** Logstash\
**Created:** [June 20, 2020, 8:27am UTC](https://discuss.elastic.co/t/how-can-i-find-some-designated-value-after-using-split/237907 "2020-06-20T08:27:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kase](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kase](https://discuss.elastic.co/u/kase)\
**Post date:** [June 20, 2020, 8:27am UTC](https://discuss.elastic.co/t/how-can-i-find-some-designated-value-after-using-split/237907/1 "2020-06-20T08:27:15Z")

</div>

Hi there,  
I have a filed looks like this format on kibana:  
`flow.tcp_flags : SYN, RST, PSH, ACK`  
I want to split each type, so I will do

```auto
fliter {
  mutate {
    split => ["[flow][tcp_flags]", ","]
  }
}

```

after this, I think data will like this:

```auto
    "flow.tcp_flags" => [
      [0] "SYN"
      [1] "RST"
      [2] "PSH"
      [3] "ACK"
    ]

```

can I find designated value after split?  
I want to do like

```auto
    fliter {
      if "SYN" in [flow][tcp_flags] {
        mutate {
          add_field => {
            "has_syn" => "true"
          }
        }
      }
    }

```

Does somebody know how to do this?  
Thanks  
Kase

---

<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 20, 2020, 3:47pm UTC](https://discuss.elastic.co/t/how-can-i-find-some-designated-value-after-using-split/237907/2 "2020-06-20T15:47:24Z")

</div>

> [@kase](#):
>
> Does somebody know how to do this?

I would expect exactly what you have written to work if you add

```
mutate { strip => ["[flow][tcp_flags]" ] }

```

to remove the leading whitespace after the split.

---

<div class="post-metadata">

**Author:** ![kase](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kase](https://discuss.elastic.co/u/kase)\
**Post date:** [June 22, 2020, 12:38am UTC](https://discuss.elastic.co/t/how-can-i-find-some-designated-value-after-using-split/237907/3 "2020-06-22T00:38:15Z")

</div>

Hi @Badger,  
thanks to your answer, I will try it.  
so

```auto
    fliter {
      if "SYN" in [flow][tcp_flags] {
        mutate {
          add_field => {
            "has_syn" => "true"
          }
        }
      }
    } 

```

can works as I expected?

---

<div class="post-metadata">

**Author:** ![kase](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kase](https://discuss.elastic.co/u/kase)\
**Post date:** [July 1, 2020, 1:32am UTC](https://discuss.elastic.co/t/how-can-i-find-some-designated-value-after-using-split/237907/4 "2020-07-01T01:32:37Z")

</div>

> [@kase](#):
>
> ```auto
> fliter {
> if "SYN" in [flow][tcp_flags] {
> mutate {
> add_field => {
> "has_syn" => "true"
> }
> }
> }
> } 
> 
> ```

I have tried this, it can works as I expected, but I also have another question, in my logstash config file, my input is elasticsearch, out is redis, so format is like:

```auto
input {
  elasticsearch {
    ....
  }
}

filter {
...
}

output {
...
}

```

I found that field I add in filter, will actually add in input elasticsearch, is that normal?

---

<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 29, 2020, 1:32am UTC](https://discuss.elastic.co/t/how-can-i-find-some-designated-value-after-using-split/237907/5 "2020-07-29T01:32:37Z")

</div>

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