# Is there a "stop" instruction in the block that skips to the next block?

**URL:** <https://discuss.elastic.co/t/is-there-a-stop-instruction-in-the-block-that-skips-to-the-next-block/311511>\
**Category:** Logstash\
**Created:** [August 5, 2022, 11:24am UTC](https://discuss.elastic.co/t/is-there-a-stop-instruction-in-the-block-that-skips-to-the-next-block/311511 "2022-08-05T11:24:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfloris](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfloris/32/100500_2.png) [@mfloris](https://discuss.elastic.co/u/mfloris)\
**Post date:** [August 5, 2022, 11:24am UTC](https://discuss.elastic.co/t/is-there-a-stop-instruction-in-the-block-that-skips-to-the-next-block/311511/1 "2022-08-05T11:24:50Z")

</div>

I want to split my filter block into separate files for better readability and easier maintenance and of course by doing that I cannot if-else through the various checks meaning that every input will go through all the filters.

In rsyslog there's a "stop" instruction that prevents this from happening but I cannot find a way to do the same thing in Logstash.

Something like this:

```auto
input {
  udp {
    port => 5514
  }
}

filter {
  if "thisToken" in [message] {
    json {
    source => "message"
    add_tag => ["this"]
   }
   stop #<------------ how?

  if "thatToken" in [message] {
    json {
    source => "message"
    add_tag => ["that"]
   }
   stop #<------------ how?
}

output {
  file {
    path => "/var/log/logstash/output.log"
  }  
}

```

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [August 5, 2022, 12:31pm UTC](https://discuss.elastic.co/t/is-there-a-stop-instruction-in-the-block-that-skips-to-the-next-block/311511/2 "2022-08-05T12:31:59Z")

</div>

No, that is not possible.

Every event will go through all the conditionals you have, but this is irrelevant as this has little to no impact in the performance.

I have the same scenario, configuration split in multiple files with conditonals, and I have no issues.

---

<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:** [September 2, 2022, 12:32pm UTC](https://discuss.elastic.co/t/is-there-a-stop-instruction-in-the-block-that-skips-to-the-next-block/311511/3 "2022-09-02T12:32:13Z")

</div>

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