# Logs are not passing into the if and else if condition

**URL:** <https://discuss.elastic.co/t/logs-are-not-passing-into-the-if-and-else-if-condition/188891>\
**Category:** Logstash\
**Created:** [July 4, 2019, 10:34am UTC](https://discuss.elastic.co/t/logs-are-not-passing-into-the-if-and-else-if-condition/188891 "2019-07-04T10:34:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![markov](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@markov](https://discuss.elastic.co/u/markov)\
**Post date:** [July 4, 2019, 10:34am UTC](https://discuss.elastic.co/t/logs-are-not-passing-into-the-if-and-else-if-condition/188891/1 "2019-07-04T10:34:25Z")

</div>

my logs are not passing into the if and else if condition, when the if is removed it works fine.  
`logstash 7.1.1`

```
> filter {
> if [source] =~ "gid" {
> grok {
> match => {"message" => "%{TIMESTAMP_ISO8601:timestamp}\|(\[%{BASE10NUM:nbr}\])\|%{IPORHOST:ClientIP}\|%{USERNAME:User};%{DATA:Node}\|%{URIPATH:Url}\|%{NOTS$
> }
> }
> }
```

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [July 6, 2019, 9:22pm UTC](https://discuss.elastic.co/t/logs-are-not-passing-into-the-if-and-else-if-condition/188891/2 "2019-07-06T21:22:51Z")

</div>

Try this:

```
if [source] and [source] == "gid" {
BLAH
}
```

---

<div class="post-metadata">

**Author:** ![markov](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@markov](https://discuss.elastic.co/u/markov)\
**Post date:** [July 7, 2019, 11:13pm UTC](https://discuss.elastic.co/t/logs-are-not-passing-into-the-if-and-else-if-condition/188891/3 "2019-07-07T23:13:41Z")

</div>

> [@AquaX](#):
>
> if [source] and [source] == "gid" {

it's not working ☹

---

<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 4, 2019, 11:13pm UTC](https://discuss.elastic.co/t/logs-are-not-passing-into-the-if-and-else-if-condition/188891/4 "2019-08-04T23:13:45Z")

</div>

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