# How to put condition based on certain string in \[message\]?

**URL:** <https://discuss.elastic.co/t/how-to-put-condition-based-on-certain-string-in-message/127169>\
**Category:** Logstash\
**Created:** [April 7, 2018, 3:48pm UTC](https://discuss.elastic.co/t/how-to-put-condition-based-on-certain-string-in-message/127169 "2018-04-07T15:48:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)\
**Post date:** [April 7, 2018, 7:44pm UTC](https://discuss.elastic.co/t/how-to-put-condition-based-on-certain-string-in-message/127169/2 "2018-04-07T19:44:27Z")

</div>

> [@amruth](#):
>
> if "source\_type="APP" in [message]{

The syntax is incorrect. Usually this one is used to check if a string is in an array field like `if "_grokparsefailure" in [tags]`. In your case you can use regex as in [Logstash if statement with regex example](https://discuss.elastic.co/t/logstash-if-statement-with-regex-example/75706)

---

_[View the full topic](https://discuss.elastic.co/t/how-to-put-condition-based-on-certain-string-in-message/127169)._
