# Metric filter based on more than one variable

**URL:** <https://discuss.elastic.co/t/metric-filter-based-on-more-than-one-variable/58708>\
**Category:** Logstash\
**Created:** [August 23, 2016, 3:55pm UTC](https://discuss.elastic.co/t/metric-filter-based-on-more-than-one-variable/58708 "2016-08-23T15:55:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bebe](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@bebe](https://discuss.elastic.co/u/bebe)\
**Post date:** [August 23, 2016, 3:55pm UTC](https://discuss.elastic.co/t/metric-filter-based-on-more-than-one-variable/58708/1 "2016-08-23T15:55:53Z")

</div>

Hello Everyone,

Is there a way to create a metric events based on more than one field, e.g. status code AND hostname?

I have tried adding a field with dynamic value, but apparently dynamic variables resolution is broken in add\_field in metrics filter and the value is added as string, without substituting %{host}.

I could create metric like  
`meter => ["code_%{code}_host_%{host}"]`  
but I won't be able to parse it later in Kibana.

I could hardcode hostnames into metrics config and add several meters with hardcoded static fields, but that's wrong on so many levels.

Is there any other way I haven't thought of?

Thanks, regards,

Bartek

---

<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, 4:42am UTC](https://discuss.elastic.co/t/metric-filter-based-on-more-than-one-variable/58708/2 "2017-07-06T04:42:01Z")

</div>

Closed on July 6, 2017, 4:42am UTC


