# Logstash: Sent formatted metrics to an Elasticsearch index

**URL:** https://discuss.elastic.co/t/logstash-sent-formatted-metrics-to-an-elasticsearch-index/155130
**Category:** Logstash
**Created:** [November 2, 2018, 8:13am UTC](https://discuss.elastic.co/t/logstash-sent-formatted-metrics-to-an-elasticsearch-index/155130 "2018-11-02T08:13:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)
#### Post date: [November 2, 2018, 8:13am UTC](https://discuss.elastic.co/t/logstash-sent-formatted-metrics-to-an-elasticsearch-index/155130/1 "2018-11-02T08:13:59Z")

</div>

I am able to capture some metrics in `stdout` from events in `logstash` using the relevant plugin as follows:

in my `filter` file:

```
  if "somekeyword" in [tags] {
    metrics {
      meter => "events_somekeyword"
      flush_interval => 60
      add_tag => "metric_somekeyword"
    }
  }

```

in my `outputs` file

```
if "metric_somekeyword" in [tags] {
        stdout {
          codec => line {
            format => "Time: %{+YYYY-MM-dd HH:mm:ss Z} | Metric: rate 1m | Client: SomeKeyword | Rate: %{[events_somekeyword][rate_1m]}"
          }
        }

```

My question is how to translate the **exact** same operation / formatting in terms of `elasticsearch` output so that the results are appropriately indexed in my `elasticsearch` instance.

---

<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 30, 2018, 8:14am UTC](https://discuss.elastic.co/t/logstash-sent-formatted-metrics-to-an-elasticsearch-index/155130/2 "2018-11-30T08:14:10Z")

</div>

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