# Defining top-level key for grok matches?

**URL:** <https://discuss.elastic.co/t/defining-top-level-key-for-grok-matches/80549>\
**Category:** Logstash\
**Created:** [March 29, 2017, 8:45pm UTC](https://discuss.elastic.co/t/defining-top-level-key-for-grok-matches/80549 "2017-03-29T20:45:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrbanzai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrbanzai/32/14750_2.png) [@mrbanzai](https://discuss.elastic.co/u/mrbanzai)\
**Post date:** [March 29, 2017, 8:45pm UTC](https://discuss.elastic.co/t/defining-top-level-key-for-grok-matches/80549/1 "2017-03-29T20:45:40Z")

</div>

I'm attempting to clean-up our Logstash configs to manage ingestion from numerous disparate sources (forwarded from other Logstash clients, filebeat, winlogbeat, etc.), and I encountered an issue with using some of the default patterns, specifically with collisions on matched field names.

As an example, from linux-syslog in logstash-patterns-core:  
`CRONLOG %{SYSLOGBASE} \(%{USER:user}\) %{CRON_ACTION:action} \(%{DATA:message}\)`

Using the grok filter with that pre-existing pattern registers a top-level "user" field ... which happens to collide with a provided winlogbeat field (which is a hash) in our setup.

Obviously I can avoid this issue by accepting the suggestion to setup source-specific templates in Elasticsearch and segregating my logs that way, or by implementing logic in my Logstash configs to move the troublesome fields under a new key, etc. ... but I was curious if it was perhaps feasible to define a top-level key under which to put all fields matched by a grok? This would make it easier to re-use core patterns but segregate fields. If necessary, I could even work on a pull request to accomplish this, but I wanted to make the proposal beforehand in case there were architectural considerations that would immediately discount the idea (assuming it's not already possible via an over-looked option to grok).

---

<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:** [March 30, 2017, 5:27am UTC](https://discuss.elastic.co/t/defining-top-level-key-for-grok-matches/80549/2 "2017-03-30T05:27:10Z")

</div>

This isn't possible right now but a PR sounds reasonable to me.

---

<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:** [April 27, 2017, 5:27am UTC](https://discuss.elastic.co/t/defining-top-level-key-for-grok-matches/80549/3 "2017-04-27T05:27:19Z")

</div>

Closed on April 27, 2017, 5:27am UTC

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