# How to include the host name in the graphite metric name

**URL:** https://discuss.elastic.co/t/how-to-include-the-host-name-in-the-graphite-metric-name/111881
**Category:** Logstash
**Created:** [December 15, 2017, 12:53am UTC](https://discuss.elastic.co/t/how-to-include-the-host-name-in-the-graphite-metric-name/111881 "2017-12-15T00:53:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vaichidrewar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vaichidrewar/32/25604_2.png) [@vaichidrewar](https://discuss.elastic.co/u/vaichidrewar)
#### Post date: [December 15, 2017, 12:53am UTC](https://discuss.elastic.co/t/how-to-include-the-host-name-in-the-graphite-metric-name/111881/1 "2017-12-15T00:53:20Z")

</div>

I want to deploy logstash config on multiple machines and push the metrics to graphite.  
So hostname needs to be part of the graphite key

Here is the config I tried.

%{host} is not getting replaced by the ip address or name of the machine on which logstash is running  
I tried using %{host} in metrics\_format as well as metrics fields. But both are not working.

How can I get the host name in the key?

```
output {
      graphite {
          host => "graphite.us-east-1.ec2.bloomreach.com"
          port => 2003
          metrics_format => "messi.spark.enhancer.%{host}.logstash.enhlog.*"
          metrics => { "input_pixel_metric" => "%{[input_pixel_metric][count]}" }
      }
}
```

---

<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: [January 12, 2018, 12:53am UTC](https://discuss.elastic.co/t/how-to-include-the-host-name-in-the-graphite-metric-name/111881/2 "2018-01-12T00:53:22Z")

</div>

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