# Grep in logstash

**URL:** <https://discuss.elastic.co/t/grep-in-logstash/24510>\
**Category:** Logstash\
**Created:** [June 28, 2015, 5:42pm UTC](https://discuss.elastic.co/t/grep-in-logstash/24510 "2015-06-28T17:42:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 28, 2015, 5:54pm UTC](https://discuss.elastic.co/t/grep-in-logstash/24510/2 "2015-06-28T17:54:47Z")

</div>

Don't use the obsolete grep filter; use [conditionals](https://www.elastic.co/guide/en/logstash/current/configuration.html#conditionals) instead, e.g. like this to delete all messages where the `foo` field isn't equal to "bar":

```
if [foo] != "bar" {
  drop { }
}

```

---

_[View the full topic](https://discuss.elastic.co/t/grep-in-logstash/24510)._
