# Logstash with metrics plugin does not replace fieldnames like %{my\_field}

**URL:** https://discuss.elastic.co/t/logstash-with-metrics-plugin-does-not-replace-fieldnames-like-my-field/27267
**Category:** Logstash
**Created:** [August 12, 2015, 2:53pm UTC](https://discuss.elastic.co/t/logstash-with-metrics-plugin-does-not-replace-fieldnames-like-my-field/27267 "2015-08-12T14:53:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![m1k3ga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/m1k3ga/32/4173_2.png) [@m1k3ga](https://discuss.elastic.co/u/m1k3ga)
#### Post date: [August 12, 2015, 2:53pm UTC](https://discuss.elastic.co/t/logstash-with-metrics-plugin-does-not-replace-fieldnames-like-my-field/27267/1 "2015-08-12T14:53:15Z")

</div>

```
Hi there,

i want include field values into my metrics record.
Therefore i used add_field and add_tag with my field "%{my_field}".
In stdout and Elasticsearch the content of `add_field` is "New field with value: %{my_field}".
In case of `add_tag` the tag is "metric, %{my_field}".

Here my sample filter:

 filter {
      mutate { add_field => { "my_field" => "hello brave new world" } }
      
      metrics { 
        add_field => { "foo" => "New field with value: %{my_field}" }
        add_tag => ["metric", "%{my_field}"] 
        meter => ["%{my_field}"] 
      }
    }

```

What am i doing wrong?

According to the [docs](https://www.elastic.co/guide/en/logstash/current/plugins-filters-metrics.html) this should work:

```
metrics {
    add_field => { "foo_%{somefield}" => "Hello world, from %{host}" }
}

```

I tried logstash versions 1.5.3 and 1.4.4 with the same effect.

---

<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, 5:32am UTC](https://discuss.elastic.co/t/logstash-with-metrics-plugin-does-not-replace-fieldnames-like-my-field/27267/2 "2017-07-06T05:32:06Z")

</div>


