title: Logstash count output
body: <p>I'm trying to do a simple task with logstash : I need to count the loglevel on a log file. I tried to use the metrics filter.</p>
  
  <p>For doing my test I use a simple file like this:</p>
  
  <pre><code>INFO
  WARN
  INFO
  WARN
  INFO
  WARN
  INFO
  </code></pre>
  
  <p>And I use this conf file :</p>
  
  <pre><code>input {
      stdin { type =&gt; "api" }
  }
  
  filter {
      grok {
          match =&gt; [ "message", "%{LOGLEVEL:loglevel}" ]
      }
  
      if [loglevel] == "WARN" {
          metrics {
              meter =&gt; "warn"
              add_tag =&gt; "metric"
          }
      }
  }
  
  output {    
      if "metric" in [tags] {
          stdout {
              codec =&gt; line {
                  format =&gt; "warn count: %{[warn][count]}"
              }
          }
      }
  }
  </code></pre>
  
  <p>The warn count is exact, I get this output:</p>
  
  <pre><code>io/console not supported; tty will not be manipulated
  Settings: Default pipeline workers: 8
  Logstash startup completed
  warn count: 3
  warn count: 3
  warn count: 3
  warn count: 3
  warn count: 3
  warn count: 3
  warn count: 3
  warn count: 3
  warn count: 3
  Logstash shutdown completed
  </code></pre>
  
  <p>Can anyone explain me why I always have 9 lines in output ? How can I do to get only one line ?</p>