# Hybrid Grok and Dissect Parsing

**URL:** https://discuss.elastic.co/t/hybrid-grok-and-dissect-parsing/288021
**Category:** Logstash
**Created:** [October 29, 2021, 4:32pm UTC](https://discuss.elastic.co/t/hybrid-grok-and-dissect-parsing/288021 "2021-10-29T16:32:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nico\_Pampaloni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nico_pampaloni/32/93706_2.png) [@Nico\_Pampaloni](https://discuss.elastic.co/u/Nico_Pampaloni)
#### Post date: [October 29, 2021, 4:32pm UTC](https://discuss.elastic.co/t/hybrid-grok-and-dissect-parsing/288021/1 "2021-10-29T16:32:34Z")

</div>

Hi Everyone! I have a question about using Dissect and Grok together when working with a format that has varying structure. A line in my log file might look like this:

word,word.word.word.word|timestamp|number,number,name|timestamp

However the number of names in a line can change so it may also look like:

word,word.word.word.word|timestamp|number,number,name|name|name|timestamp

For log files with the same structure but only single names in them, I am using Dissect to parse the different fields and it's working great. For this specific log with a varying number of names in it, I can't seem to find a way to use Dissect and Grok together to make this work.

Any suggestions would be greatly appreciated.  
Thanks!

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [October 29, 2021, 5:33pm UTC](https://discuss.elastic.co/t/hybrid-grok-and-dissect-parsing/288021/2 "2021-10-29T17:33:28Z")

</div>

Use dissect to parse the fixed prefix and grok with an array of patterns for the variable part. An example is [here](https://discuss.elastic.co/t/metatrader-how-parse-such-logs/248406/2).

---

<div class="post-metadata">

### Author: ![Nico\_Pampaloni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nico_pampaloni/32/93706_2.png) [@Nico\_Pampaloni](https://discuss.elastic.co/u/Nico_Pampaloni)
#### Post date: [November 1, 2021, 11:25am UTC](https://discuss.elastic.co/t/hybrid-grok-and-dissect-parsing/288021/3 "2021-11-01T11:25:35Z")

</div>

Thanks for the response!! That's super helpful. My only issue now is how to get Grok to deal with a varying number of name fields.

---

<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: [November 29, 2021, 11:26am UTC](https://discuss.elastic.co/t/hybrid-grok-and-dissect-parsing/288021/4 "2021-11-29T11:26:28Z")

</div>

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