# Drop everything and only filter for specific fileds

**URL:** <https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223>\
**Category:** Logstash\
**Created:** [August 16, 2017, 9:41am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223 "2017-08-16T09:41:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sentinel](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sentinel](https://discuss.elastic.co/u/sentinel)\
**Post date:** [August 16, 2017, 9:41am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223/1 "2017-08-16T09:41:37Z")

</div>

In my config file I have a very long list of these drops:

```
                           if ([EventType]=="CachedRateDataStore"){
                                    drop { }
                    }
                           if ([EventType]=="ChronoStats"){
                                    drop { }

```

etc

I have also got a number of filters

( "PriceRequestProcessor" in [message]) or  
( "PfPriceRequestRejectExecutor" in [message])  
{  
kv {  
etc

I just realised that my "drop" list is growing long. In fact I'm not interested in any other fields except the ones I'm filtering with kv.

How do I drop just about everything and only apply filters the 2 fields up here. That stops me from having to explicitly drop spcecific fields. If the items aren't PriceRequestProcessor or PfPriceRequestRejectExecutor, then drop them all.

---

<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:** [August 16, 2017, 10:07am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223/2 "2017-08-16T10:07:28Z")

</div>

Perhaps

```nohighlight
if [EventType] not in ["CachedRateDataStore", "ChronoStats"] {
  drop { }
}

```

is what you're looking for.

---

<div class="post-metadata">

**Author:** ![sentinel](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sentinel](https://discuss.elastic.co/u/sentinel)\
**Post date:** [August 16, 2017, 10:10am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223/3 "2017-08-16T10:10:40Z")

</div>

That will still mean I create a list ... I'm only interested in PriceRequestProcessor and PfPriceRequestRejectExecutor in message then drop everything else.

---

<div class="post-metadata">

**Author:** ![sentinel](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sentinel](https://discuss.elastic.co/u/sentinel)\
**Post date:** [August 16, 2017, 10:15am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223/4 "2017-08-16T10:15:16Z")

</div>

will this work?

If ["PfPriceRequestRejectExecutor", "PriceRequestProcessor"] not in [message] {  
drop { }  
}

---

<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:** [August 16, 2017, 10:22am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223/5 "2017-08-16T10:22:29Z")

</div>

This is confusing. Do you want to drop all messages except those with EventType being either CachedRateDataStore or ChronoStats **and** a message that contains PriceRequestProcessor or PfPriceRequestRejectExecutor?

---

<div class="post-metadata">

**Author:** ![sentinel](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sentinel](https://discuss.elastic.co/u/sentinel)\
**Post date:** [August 16, 2017, 10:28am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223/6 "2017-08-16T10:28:18Z")

</div>

Sorry Magnus

I meant to get rid of anything that doesn't have PriceRequestProcessor or PfPriceRequestRejectExecutor as eventType.

---

<div class="post-metadata">

**Author:** ![sentinel](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sentinel](https://discuss.elastic.co/u/sentinel)\
**Post date:** [August 16, 2017, 10:42am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223/7 "2017-08-16T10:42:20Z")

</div>

I think I figured it out with this:

if [EventType] not in ["PriceRequestProcessor","PfPriceRequestRejectExecutor","PriceRequestListener","DiscountPointRequestBlock","PfClientEnrichmentBlock"] {  
drop { }

---

<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:** [September 13, 2017, 10:42am UTC](https://discuss.elastic.co/t/drop-everything-and-only-filter-for-specific-fileds/97223/8 "2017-09-13T10:42:25Z")

</div>

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