# Logstash configuration input error with if statement

**URL:** <https://discuss.elastic.co/t/logstash-configuration-input-error-with-if-statement/246019>\
**Category:** Logstash\
**Created:** [August 23, 2020, 12:55pm UTC](https://discuss.elastic.co/t/logstash-configuration-input-error-with-if-statement/246019 "2020-08-23T12:55:19Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 23, 2020, 11:32pm UTC](https://discuss.elastic.co/t/logstash-configuration-input-error-with-if-statement/246019/10 "2020-08-23T23:32:18Z")

</div>

Note that you could do it using a single pipeline, but this is a terrible idea, since if you get anything wrong it sets up an infinite loop, like this

```
input {
     beats { port => 5044 }
     tcp { port => 5144 codec => cef {} }
}
output {
    if "forcepoint" in [tags] {
        tcp { port => 5144 }
    } else {
        elasticsearch { ... }
    }
}

```

Where you might get away with

```
input {
    beats { port => 5044 }
    tcp { port => 5144 codec => cef {} tags => ["decoded"] }
}
output {
    if "forcepoint" in [tags] and "decoded" not in [tags] {
        tcp { port => 5144 }
    } else {
        elasticsearch { ... }
    }
}
```

---

_[View the full topic](https://discuss.elastic.co/t/logstash-configuration-input-error-with-if-statement/246019)._
