# Metrics to graphite output not flushing at proper intervals when also using ES output

**URL:** https://discuss.elastic.co/t/metrics-to-graphite-output-not-flushing-at-proper-intervals-when-also-using-es-output/72104
**Category:** Logstash
**Created:** [January 19, 2017, 1:10am UTC](https://discuss.elastic.co/t/metrics-to-graphite-output-not-flushing-at-proper-intervals-when-also-using-es-output/72104 "2017-01-19T01:10:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dai](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@dai](https://discuss.elastic.co/u/dai)
#### Post date: [January 19, 2017, 1:10am UTC](https://discuss.elastic.co/t/metrics-to-graphite-output-not-flushing-at-proper-intervals-when-also-using-es-output/72104/1 "2017-01-19T01:10:32Z")

</div>

I'm trying to use logstash to tail a log file, parse it, and both measure the stats on how many times a particular type of line shows up per minute and send that stat to graphite, and also send all parsed lines to elasticsearch.

I'm running into an issue where if I include the elasticsearch output, the metrics being sent to graphite are no longer being sent at the right intervals.

Here is an example config I have that has names altered:

```
input {
  file {
    path => "/data/log/example.log"
    codec => plain
    sincedb_path => "/data/logstash/.sincedb"
    sincedb_write_interval => 5
  }
}

filter {
  grok {
    match => { "message" => "^%{TIMESTAMP_ISO8601:ts} %{WORD:type}" }
    overwrite => ["message"]
  }

  if [type] == "some_type" {
    grok {
      match => { "message" => "^some_message" }
      add_tag => ["interesting_logline"]
    }
  }

  if "interesting_logline" in [tags] {
    metrics {
      meter => ["logstash.interesting_logline"]
      clear_interval => 60
      flush_interval => 60
      add_tag => "metric"
      percentiles => []
      rates => []
    }
  }
}

output {
  if "_grokparsefailure" in [tags] {
    file { path => "/data/log/logstash/parsefailure.log" }
  }

  if "metric" in [tags] {
    graphite {
      host => "graphite-host"
      port => 2003
      include_metrics => ["logstash.*"]
      fields_are_metrics => true
      resend_on_failure => true
    }
  }
  else {
    elasticsearch {
      hosts => ["elasticsearch:9200"]
      index => "logstash-%{+YYYY.MM.dd}"
      flush_size => 1000
      idle_flush_time => 10
      workers => 1
      codec => "json"
    }
  }
}

```

If I omit the elasticsearch output stanza, then I get metrics in graphite every 60 seconds like I expect. When I include it however, I only get metrics every few minutes sporadically. I've tried with logstash v2.3.2 and also v5.1.1, and both behave the same way. Is there something else I should be doing to get the metrics output to send consistently to graphite on a fixed interval?

---

<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: [February 16, 2017, 1:11am UTC](https://discuss.elastic.co/t/metrics-to-graphite-output-not-flushing-at-proper-intervals-when-also-using-es-output/72104/2 "2017-02-16T01:11:00Z")

</div>

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