# How to put ":" into if statement in filter?

**URL:** <https://discuss.elastic.co/t/how-to-put-into-if-statement-in-filter/307319>\
**Category:** Logstash\
**Created:** [June 15, 2022, 9:34pm UTC](https://discuss.elastic.co/t/how-to-put-into-if-statement-in-filter/307319 "2022-06-15T21:34:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roman-tasi](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@roman-tasi](https://discuss.elastic.co/u/roman-tasi)\
**Post date:** [June 15, 2022, 9:34pm UTC](https://discuss.elastic.co/t/how-to-put-into-if-statement-in-filter/307319/1 "2022-06-15T21:34:25Z")

</div>

I am currently trying this:

`if ":" in dst {`

I also have tried ":" and ':' (backslash before the colon) but neither worked.

Is it possible to still try this?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 15, 2022, 10:45pm UTC](https://discuss.elastic.co/t/how-to-put-into-if-statement-in-filter/307319/2 "2022-06-15T22:45:55Z")

</div>

This is already the correct way and should work.

```auto
if ":" in field { do something }

```

Can you share an example of your message and what you are trying to do?

---

<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 15, 2022, 10:59pm UTC](https://discuss.elastic.co/t/how-to-put-into-if-statement-in-filter/307319/3 "2022-06-15T22:59:32Z")

</div>

I would expect that to result in an exception from the configuration compiler. Try `if ":" in [dst] {`.

---

<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 13, 2022, 11:00pm UTC](https://discuss.elastic.co/t/how-to-put-into-if-statement-in-filter/307319/4 "2022-07-13T23:00:08Z")

</div>

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