# Logstash metrics filter not working after logstash 2.2.0 upgrade

**URL:** <https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220>\
**Category:** Logstash\
**Created:** [February 8, 2016, 8:02pm UTC](https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220 "2016-02-08T20:02:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![biswajit86](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@biswajit86](https://discuss.elastic.co/u/biswajit86)\
**Post date:** [February 8, 2016, 8:02pm UTC](https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220/1 "2016-02-08T20:02:01Z")

</div>

I have an existing logstash config that reads data from topbeat and outputs data to kafka(config below). I have added the metrics filter to get the throughput of documents processed. After upgrading to logstash 2.2.0 ,I am not seeing any output in stdout from metrics filter.This only started happening after upgrading to logstash-2.2.0.

> input {  
> beats {  
> port =\> 5044  
> }  
> }

> filter {  
> if [type] == "process" {  
> if [proc][username] == "root" and [proc][cpu][total\_p] \< 0.1 and [proc][mem][rss] \< 1000000 {  
> drop{}  
> }else{  
> metrics {  
> meter =\> "documents"  
> add\_tag =\> "metric"  
> flush\_interval =\> 60  
> }  
> }  
> }  
> }

> output {  
> if "metric" in [tags] {  
> stdout {  
> codec =\> line { format =\> "1m rate| %{@timestamp} | %{[documents][rate\_1m]} 5m rate: %{[documents][rate\_5m]} ( %{[documents][count]} ) "}  
> }  
> }else {  
> kafka {  
> topic\_id =\> "topbeat-stage"  
> acks =\> "all"  
> }  
> }  
> }

---

<div class="post-metadata">

**Author:** ![tetlika](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@tetlika](https://discuss.elastic.co/u/tetlika)\
**Post date:** [February 21, 2016, 4:20pm UTC](https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220/2 "2016-02-21T16:20:01Z")

</div>

hi, have you managed to fix that?

I have also issue with metrics but on 2.2.0 and 2.2.2, and do not know how to fix it

---

<div class="post-metadata">

**Author:** ![Joe\_Lawson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_lawson/32/3390_2.png) [@Joe\_Lawson](https://discuss.elastic.co/u/Joe_Lawson)\
**Post date:** [February 21, 2016, 5:52pm UTC](https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220/3 "2016-02-21T17:52:24Z")

</div>

Type doesn't work anymore.  
[https://www.elastic.co/guide/en/logstash/master/breaking-changes.html](https://www.elastic.co/guide/en/logstash/master/breaking-changes.html) use  
add\_tag or add\_field.

---

<div class="post-metadata">

**Author:** ![biswajit86](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@biswajit86](https://discuss.elastic.co/u/biswajit86)\
**Post date:** [February 22, 2016, 4:52am UTC](https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220/4 "2016-02-22T04:52:08Z")

</div>

according to the documentation, `Configuration files with these settings present are invalid and prevent Logstash from starting.`

Why is my logstash configuration starting succesfully then ? Not only I am seeing it start , it is also succesfully aplying the logic that is encapuslated in the `[tags]` construct

---

<div class="post-metadata">

**Author:** ![Joe\_Lawson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_lawson/32/3390_2.png) [@Joe\_Lawson](https://discuss.elastic.co/u/Joe_Lawson)\
**Post date:** [February 22, 2016, 1:35pm UTC](https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220/5 "2016-02-22T13:35:21Z")

</div>

With filters there is the possibility that a "type" field is present in  
your log payload which would make the value type valid from a validation  
prospective.

---

<div class="post-metadata">

**Author:** ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)\
**Post date:** [July 14, 2016, 5:06pm UTC](https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220/6 "2016-07-14T17:06:48Z")

</div>

Due to some performance issue I have to revert from LS 2.3.3 to 2.2.0 and get the same problem with metrics plugin.

Below is my test config for LS 2.2.0

```auto
input {
      generator {
        type => "generated"
      }
    }

filter {
    metrics {
      meter => "events"
      add_tag => "metric"
    }
}

output {
  # only emit events with the 'metric' tag
  if "metric" in [tags] {
    file {
		path => "C:/metrics.txt"
	    codec => json
    }
  } else {
    file {        
        path => "C:/out.txt"
    }
  }
}

```

What I see is that metrics.txt is created only if I stop LS. Same config works fine on LS 2.3.x

---

<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:** [July 6, 2017, 4:48am UTC](https://discuss.elastic.co/t/logstash-metrics-filter-not-working-after-logstash-2-2-0-upgrade/41220/7 "2017-07-06T04:48:02Z")

</div>


