# Logstash drop filter is not dropping events

**URL:** <https://discuss.elastic.co/t/logstash-drop-filter-is-not-dropping-events/27396>\
**Category:** Logstash\
**Created:** [August 14, 2015, 1:18pm UTC](https://discuss.elastic.co/t/logstash-drop-filter-is-not-dropping-events/27396 "2015-08-14T13:18:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rubaiyat\_Islam\_Sadat](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@Rubaiyat\_Islam\_Sadat](https://discuss.elastic.co/u/Rubaiyat_Islam_Sadat)\
**Post date:** [August 14, 2015, 1:18pm UTC](https://discuss.elastic.co/t/logstash-drop-filter-is-not-dropping-events/27396/1 "2015-08-14T13:18:07Z")

</div>

I am having a very strange situation where I have the following filter rule

if [logger\_name] == "REPORT" {  
drop {}  
}

and I expect that any events with my field\_name == "logger\_name" with that specific value will be dropped, but it seems that those aren't. Anyone shedding any light on it? I will really appreciate it. Note that I have preceding and succeeding additional filter rules too. Any other area that I have skipped to look into?

---

<div class="post-metadata">

**Author:** ![hasan\_sharekhan](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hasan\_sharekhan](https://discuss.elastic.co/u/hasan_sharekhan)\
**Post date:** [June 23, 2017, 6:14am UTC](https://discuss.elastic.co/t/logstash-drop-filter-is-not-dropping-events/27396/2 "2017-06-23T06:14:11Z")

</div>

It worked for me, i have added if condition inside filter but outside grok tag, below is my code.

Dont get confused with my pattern. just see if condition, it is using the column name given in match creteria

> filter {  
> grok {  
> patterns\_dir =\> ["test/mylog/pattern"]   
> match =\> { "message" =\> "%{GREEDYDATA\_END\_NOSPACE:logTimestamp}%{ZERO\_OR\_MORE\_SPACE}[%{TT\_TS\_LOG\_TYPE:logType}]%{ZERO\_OR\_MORE\_SPACE}"%{GREEDYDATA:logMsg}"" }

> }

> if [logType] == "I" {  
> 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:** [November 4, 2022, 4:04am UTC](https://discuss.elastic.co/t/logstash-drop-filter-is-not-dropping-events/27396/3 "2022-11-04T04:04:14Z")

</div>


