# Filebeat drop\_event has\_fields condition

**URL:** <https://discuss.elastic.co/t/filebeat-drop-event-has-fields-condition/179139>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [April 30, 2019, 7:22pm UTC](https://discuss.elastic.co/t/filebeat-drop-event-has-fields-condition/179139 "2019-04-30T19:22:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arianmotamedi](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@arianmotamedi](https://discuss.elastic.co/u/arianmotamedi)\
**Post date:** [April 30, 2019, 7:22pm UTC](https://discuss.elastic.co/t/filebeat-drop-event-has-fields-condition/179139/1 "2019-04-30T19:22:49Z")

</div>

I have defined two drop\_event conditions to exclude a subset of logs from making it to elastic:

```
processors:
  - add_kubernetes_metadata:
      in_cluster: true
      namespace: ${POD_NAMESPACE}
  - drop_event:
      when:
        equals:
          kubernetes.container.name: "filebeat"
  - drop_event:
      when:
        not:
          has_fields: ["kubernetes.namespace"]

```

First condition works fine, but after adding the second `drop_event` item, I'm getting

> ERROR processors/condition.go:450 Failed to initialize lookup condition: missing condition

I'm not sure why it says condition is missing. Can I not combine `not` and `has_fields`?

---

<div class="post-metadata">

**Author:** ![Debashis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/debashis/32/45290_2.png) [@Debashis](https://discuss.elastic.co/u/Debashis)\
**Post date:** [May 2, 2019, 6:47am UTC](https://discuss.elastic.co/t/filebeat-drop-event-has-fields-condition/179139/2 "2019-05-02T06:47:21Z")

</div>

@arianmotamedi Obviously you can combine "not" and "has\_fields" . I have did below configuration and it is working fine. As you can see I have also used "not" and "has\_fields" together.

```
  filebeat.inputs:
  - type: log
    enabled: true
    paths:
     - /var/log/sample.log
     - /var/log/sample1.log
     - /var/log/sample2.log
 
  processors:
    - include_fields:
        when:
          equals:
            source: /var/log/sample.log
        fields: ["tmp"]
    - drop_event:
        when:
          equals:
            source: /var/log/sample1.log
    - drop_event:
        when:
          not:
            has_fields: ["tmp"]

```

Kindly recheck your config file, It's looking ok what you have shared.

---

<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:** [May 30, 2019, 6:50am UTC](https://discuss.elastic.co/t/filebeat-drop-event-has-fields-condition/179139/3 "2019-05-30T06:50:56Z")

</div>

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