# Incorrect regexp reaction

**URL:** <https://discuss.elastic.co/t/incorrect-regexp-reaction/263001>\
**Category:** Beats\
**Tags:** winlogbeat\
**Created:** [February 2, 2021, 2:50pm UTC](https://discuss.elastic.co/t/incorrect-regexp-reaction/263001 "2021-02-02T14:50:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmalchikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dmalchikov/32/72921_2.png) [@dmalchikov](https://discuss.elastic.co/u/dmalchikov)\
**Post date:** [February 2, 2021, 2:50pm UTC](https://discuss.elastic.co/t/incorrect-regexp-reaction/263001/1 "2021-02-02T14:50:53Z")

</div>

Hi! Using ELK 7.10 Tried different terms but result always go through  
My winlogbeat.yml:

......  
'- name: Windows PowerShell  
event\_id: 400, 403, 600, 800  
processors:  
- drop\_event.when.or:  
- regexp.process.command\_line.text: 'zabbix'  
- regexp.process.args: 'zabbix'  
- script:  
lang: javascript  
.......

Event with expected as dropped:  
process.args = powershell.exe,-File, C:\zabbix\Discovery.mssql.ps1, JSONJOBNAME  
process.args\_count = 7  
process.command\_line = powershell.exe -File C:\zabbix\Discovery.mssql.ps1 JSONJOBNAME.

I just want to drop all events with "zabbix" in it. What can be wrong?

---

<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:** [February 2, 2021, 8:06pm UTC](https://discuss.elastic.co/t/incorrect-regexp-reaction/263001/2 "2021-02-02T20:06:30Z")

</div>

The problem might be with ordering of the processors. The script processor for powershell creates the `process.command_line` field. So to drop based on that field you would need to do the drop after the script runs.

So try:

```auto
- name: Windows PowerShell
  event_id: 400, 403, 600, 800
  processors:
     - script:
         lang: javascript
         id: powershell
         file: ${path.home}/module/powershell/config/winlogbeat-powershell.js
     - drop_event:
         when.or:
           - contains.process.command_line: 'zabbix'
           - contains.process.args: 'zabbix'

```

---

<div class="post-metadata">

**Author:** ![dmalchikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dmalchikov/32/72921_2.png) [@dmalchikov](https://discuss.elastic.co/u/dmalchikov)\
**Post date:** [February 3, 2021, 8:53am UTC](https://discuss.elastic.co/t/incorrect-regexp-reaction/263001/3 "2021-02-03T08:53:02Z")

</div>

I didn't even guess...  
Thanks!

Just config work only with my syntax. Proposed didn't pass test

---

<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:** [February 3, 2021, 1:17pm UTC](https://discuss.elastic.co/t/incorrect-regexp-reaction/263001/4 "2021-02-03T13:17:07Z")

</div>

My indentation looks like it got messed up somewhere in copy/pasting between apps. I fixed it now.

---

<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:** [March 3, 2021, 3:17pm UTC](https://discuss.elastic.co/t/incorrect-regexp-reaction/263001/5 "2021-03-03T15:17:23Z")

</div>

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