# Can I use grok to match fields?

**URL:** <https://discuss.elastic.co/t/can-i-use-grok-to-match-fields/1343>\
**Category:** Logstash\
**Created:** [May 26, 2015, 9:28pm UTC](https://discuss.elastic.co/t/can-i-use-grok-to-match-fields/1343 "2015-05-26T21:28:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jruybal](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jruybal](https://discuss.elastic.co/u/jruybal)\
**Post date:** [May 26, 2015, 9:28pm UTC](https://discuss.elastic.co/t/can-i-use-grok-to-match-fields/1343/1 "2015-05-26T21:28:43Z")

</div>

Is it possible to use grok to match multiple fields using regex?

I have the metrics filter generating logs. Fields are generated per host and look like `event.$HOST.count`

At this point I'm trying

```
match => ["event\.%{DATA}\.count", "0"]
add_tag => "inactive"

```

Configtest shows no errors, however I cannot see anything generated here. Totally understand if this isn't possible.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 31, 2015, 10:49am UTC](https://discuss.elastic.co/t/can-i-use-grok-to-match-fields/1343/2 "2015-05-31T10:49:46Z")

</div>

> ```
> match => ["event\.%{DATA}\.count", "0"]
> add_tag => "inactive"
> 
> ```

Is this snippet from the grok filter? What is it supposed to mean? The `match` parameter of a grok filter should point to an array (or hash, I suppose) where the first element (or hash key) is a field name to match against and the second value (or hash value) is the grok expression. So,

```
match => ["message", "event\.%{DATA}\.count"]

```

makes sense (although nothing it captured) but what you have above doesn't.

---

<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:38am UTC](https://discuss.elastic.co/t/can-i-use-grok-to-match-fields/1343/3 "2017-07-06T05:38:59Z")

</div>


