# Use nested field names in Grok custom patterns

**URL:** <https://discuss.elastic.co/t/use-nested-field-names-in-grok-custom-patterns/311728>\
**Category:** Logstash\
**Tags:** ingest-pipeline\
**Created:** [August 9, 2022, 12:43pm UTC](https://discuss.elastic.co/t/use-nested-field-names-in-grok-custom-patterns/311728 "2022-08-09T12:43:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vilman](https://avatars.discourse-cdn.com/v4/letter/v/51bf81/32.png) [@vilman](https://discuss.elastic.co/u/vilman)\
**Post date:** [August 9, 2022, 12:43pm UTC](https://discuss.elastic.co/t/use-nested-field-names-in-grok-custom-patterns/311728/1 "2022-08-09T12:43:18Z")

</div>

Hi,

I'm trying to map a nested field from a custom grok expression.

So, instead of using:  
`(?=.*?Message Type: (?<test1>[^;]+))?`

I would like to map test1 to [event][name].

Tried things like:

```auto
(?=.*?Message Type: (?<[event][name]>[^;]+))?
(?=.*?Message Type: (?<event.name>[^;]+))?
(?=.*?Message Type: (?<{[event][name]}>[^;]+))?
...

```

Is that even possible? I know I could rename them later but that's not the idea...

Thanks!

---

<div class="post-metadata">

**Author:** ![vilman](https://avatars.discourse-cdn.com/v4/letter/v/51bf81/32.png) [@vilman](https://discuss.elastic.co/u/vilman)\
**Post date:** [August 9, 2022, 12:49pm UTC](https://discuss.elastic.co/t/use-nested-field-names-in-grok-custom-patterns/311728/2 "2022-08-09T12:49:40Z")

</div>

This seems related to a support library issue. Can't be fixed at least 3y ago. An option would be to define custom patterns.

See [Parse regex to a nested field · Issue #66 · logstash-plugins/logstash-filter-grok · GitHub](https://github.com/logstash-plugins/logstash-filter-grok/issues/66).

---

<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:** [September 6, 2022, 12:50pm UTC](https://discuss.elastic.co/t/use-nested-field-names-in-grok-custom-patterns/311728/3 "2022-09-06T12:50:23Z")

</div>

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