# Dropping fields doesnt work

**URL:** <https://discuss.elastic.co/t/dropping-fields-doesnt-work/94469>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 25, 2017, 11:30am UTC](https://discuss.elastic.co/t/dropping-fields-doesnt-work/94469 "2017-07-25T11:30:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![randude](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randude/32/34911_2.png) [@randude](https://discuss.elastic.co/u/randude)\
**Post date:** [July 25, 2017, 11:30am UTC](https://discuss.elastic.co/t/dropping-fields-doesnt-work/94469/1 "2017-07-25T11:30:31Z")

</div>

Hi,  
I'd like to drop the beat fields. I've used the formal docs and added the processors part but the fields are still in the data for some reason. What am I doing wrong?

This is my yaml file for metricbeat 5.5.0:

```auto
metricbeat.modules:
- module: system
  metricsets: ["process"]
  filters:
    - drop_event.when.regexp.name: '(bioset|python|sshd|bash|sftp-server|atop|java|cron|acpi_thermal_pm|agetty|ata_sff)'
  processors:
   - drop_fields:
       fields: ["beat", "process.cmdline"]
  enabled: true
  period: 30s
  processes: ['.*']

```

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [July 25, 2017, 12:44pm UTC](https://discuss.elastic.co/t/dropping-fields-doesnt-work/94469/2 "2017-07-25T12:44:43Z")

</div>

Try changing it to:

```auto
metricbeat.modules:
- module: system
  metricsets: ["process"]
  filters:
    - drop_event.when.regexp.name: '(bioset|python|sshd|bash|sftp-server|atop|java|cron|acpi_thermal_pm|agetty|ata_sff)'
  enabled: true
  period: 30s
  processes: ['.*']

processors:
- drop_fields:
    fields: ["beat", "system.process.cmdline"]

```

---

<div class="post-metadata">

**Author:** ![randude](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randude/32/34911_2.png) [@randude](https://discuss.elastic.co/u/randude)\
**Post date:** [July 25, 2017, 1:43pm UTC](https://discuss.elastic.co/t/dropping-fields-doesnt-work/94469/3 "2017-07-25T13:43:28Z")

</div>

YES! it works!  
Thanks a lot!

Do you know by any chance how to change the regexp to a regex that matches a word that doesnt contain the word "company"?  
I've tried several perl expressions, but it seems that it doesnt like the ?! combination.

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [July 25, 2017, 2:12pm UTC](https://discuss.elastic.co/t/dropping-fields-doesnt-work/94469/4 "2017-07-25T14:12:59Z")

</div>

I don't know of any way to do it with the [re2](https://github.com/google/re2/wiki/Syntax) regular expressions supported by Go.

But you could negate the by adding `not`.

`drop_event.when.not.regexp.name: 'company'`

---

<div class="post-metadata">

**Author:** ![randude](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randude/32/34911_2.png) [@randude](https://discuss.elastic.co/u/randude)\
**Post date:** [July 25, 2017, 3:13pm UTC](https://discuss.elastic.co/t/dropping-fields-doesnt-work/94469/5 "2017-07-25T15:13:37Z")

</div>

You are awesome man.  
It all works!

---

<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:** [August 22, 2017, 3:13pm UTC](https://discuss.elastic.co/t/dropping-fields-doesnt-work/94469/6 "2017-08-22T15:13:44Z")

</div>

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