# Metric Filter - Unable to get field references

**URL:** https://discuss.elastic.co/t/metric-filter-unable-to-get-field-references/65586
**Category:** Logstash
**Created:** [November 10, 2016, 6:34am UTC](https://discuss.elastic.co/t/metric-filter-unable-to-get-field-references/65586 "2016-11-10T06:34:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![washal](https://avatars.discourse-cdn.com/v4/letter/w/53a042/32.png) [@washal](https://discuss.elastic.co/u/washal)
#### Post date: [November 10, 2016, 6:34am UTC](https://discuss.elastic.co/t/metric-filter-unable-to-get-field-references/65586/1 "2016-11-10T06:34:54Z")

</div>

Hello,

I'm using the metrics filter in Logstash to count the number of events triggered per firewall rule.  
So, I've got a LS config as below:

```
if [policyid] {
	metrics {
		add_tag => ["metric"]
		add_field => {"devname" => "%{devname}"}
		meter => "%{devname}_%{policyid}"					
		flush_interval => 5
	}
  }

```

I get an output as below (snippet)

```
"XYZ_32" => {
         "rate_1m" => 0.22862424978029233,
        "rate_15m" => 0.11346270423993854,
           "count" => 67,
         "rate_5m" => 0.10272096009080509
 },
 "devname" => "%{devname}",
 "message" => "TESTSYSTEM",
 "tags" => [
    [0] "metric"
]

```

As can be seen above, **"devname" =\> "%{devname}"** doesn't reference properly. However, the metric field is able to pick up the field reference properly **"XYZ\_32"**

Can anyone help me understand why metric filter is unable to reference fields properly?

Thanks

---

<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: [December 8, 2016, 6:35am UTC](https://discuss.elastic.co/t/metric-filter-unable-to-get-field-references/65586/2 "2016-12-08T06:35:04Z")

</div>

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