# \[Bug\] Metric Filter Events Ignore Conditionals

**URL:** <https://discuss.elastic.co/t/bug-metric-filter-events-ignore-conditionals/153656>\
**Category:** Logstash\
**Created:** [October 23, 2018, 5:13pm UTC](https://discuss.elastic.co/t/bug-metric-filter-events-ignore-conditionals/153656 "2018-10-23T17:13:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alsheh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alsheh/32/36799_2.png) [@Alsheh](https://discuss.elastic.co/u/Alsheh)\
**Post date:** [October 23, 2018, 5:13pm UTC](https://discuss.elastic.co/t/bug-metric-filter-events-ignore-conditionals/153656/1 "2018-10-23T17:13:22Z")

</div>

Events generated by the `metrics` filter ignore conditionals and execute all filters after the `metrics` filter.

Logstash version: `6.4.2`

logstash.conf:

```auto
input {
  tcp {
    port => 11224
  }
}
filter {
  kv { }
  if 'true' {
    if 'true' {
      metrics {
	    meter => {'http_%{response}' => '%{response}'}
	    add_tag => ['metric1']
      }
    }
  }
  else if 'false' == 'true' {
    mutate { add_tag => ['metric2'] }
  }
  else {
    mutate { add_tag => ['metric3'] }
  }
}
output {
  stdout {
    codec => rubydebug { metadata => true }
  }
}

```

Expected output should contain the `metric1` tag only but Logstash includes tags added in different conditional blocks:

```auto
{
               "@timestamp" => 2018-10-23T17:07:06.028Z,
    "\"http_200\", \"200\"" => {
        "rate_15m" => 0.16014748058336145,
         "rate_1m" => 0.00713479866945049,
           "count" => 1,
         "rate_5m" => 0.10268342380651842
    },
                 "@version" => "1",
                  "message" => "539d27e3f0df",
                     "tags" => [
        [0] "metric1",
        [1] "metric2",
        [2] "metric3"
    ]
}

```

---

<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:** [November 20, 2018, 5:22pm UTC](https://discuss.elastic.co/t/bug-metric-filter-events-ignore-conditionals/153656/2 "2018-11-20T17:22:00Z")

</div>

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