# 'when not' not working

**URL:** <https://discuss.elastic.co/t/when-not-not-working/267114>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [March 12, 2021, 4:59pm UTC](https://discuss.elastic.co/t/when-not-not-working/267114 "2021-03-12T16:59:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elbadar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elbadar/32/85472_2.png) [@elbadar](https://discuss.elastic.co/u/elbadar)\
**Post date:** [March 12, 2021, 4:59pm UTC](https://discuss.elastic.co/t/when-not-not-working/267114/1 "2021-03-12T16:59:05Z")

</div>

Hi guys, trying to push all log messages that contain 'Failed' or 'ERROR', but doesn't seem to like my syntax. I have looked at the syntax quite a bit but can't seem to nail it down. Didn't find any examples of "when not" for message.

```auto
    processors:
      - add_host_metadata: ~
      - add_cloud_metadata: ~
      - drop_event:
            when:
                not:
                    message: "Failed"
                 or:
                    message: "ERROR"

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![elbadar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elbadar/32/85472_2.png) [@elbadar](https://discuss.elastic.co/u/elbadar)\
**Post date:** [March 12, 2021, 7:08pm UTC](https://discuss.elastic.co/t/when-not-not-working/267114/2 "2021-03-12T19:08:25Z")

</div>

I believe I've solved the problem by just putting it under the log as:

```auto
- type: log
  paths:
    - [path_here]
  scan_frequency: 10s
  include_lines: ['Failed', 'ERROR']

```

---

<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:** [April 9, 2021, 9:09pm UTC](https://discuss.elastic.co/t/when-not-not-working/267114/3 "2021-04-09T21:09:24Z")

</div>

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