# Problems with Drop Filter in Logstash

**URL:** <https://discuss.elastic.co/t/problems-with-drop-filter-in-logstash/186394>\
**Category:** Logstash\
**Created:** [June 19, 2019, 7:14am UTC](https://discuss.elastic.co/t/problems-with-drop-filter-in-logstash/186394 "2019-06-19T07:14:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghostrider](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@Ghostrider](https://discuss.elastic.co/u/Ghostrider)\
**Post date:** [June 19, 2019, 7:14am UTC](https://discuss.elastic.co/t/problems-with-drop-filter-in-logstash/186394/1 "2019-06-19T07:14:57Z")

</div>

Hey guys,  
I am a total amateur with logstash and I try to build something small, I think. I am currently using winlogbeat to get windows events, but I want to customize the filter a bit.

The goal of my filter is that I want to drop all logs with level "information", except logs with the log\_name: "Dhcp-Server" or winlog.event\_id "4740".

Win Event "4740" accurs if a user is locking himself, 10 times wrong password.

Small Information: I am using a german windows server dc, and because of that the log\_level is "informationen" its the same value I see in Kibana.

```auto
filter {
  if "active directory" in [tags] {
    if [log][level] == "informationen" and [log_name] != "Dhcp-Server" or [winlog][event_id] != "4740"{
      drop { }
    }
    mutate {
      remove_field => ["host"]
    }
  }
}

```

But it never get the 4740 messages to appear in kibana, so I assume that something is wrong there. It seems that the "drop" drops all events with log.level informations and doesnt care the rest in the if statement.

Best regards,

---

<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 20, 2019, 8:22pm UTC](https://discuss.elastic.co/t/problems-with-drop-filter-in-logstash/186394/2 "2019-06-20T20:22:02Z")

</div>

My guess is that the order of precedence of and/or is not what you are assuming. You should add parentheses to make the order explicit.

---

<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 18, 2019, 8:22pm UTC](https://discuss.elastic.co/t/problems-with-drop-filter-in-logstash/186394/3 "2019-07-18T20:22:07Z")

</div>

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