# What is the grok expression that can match variable length documents from a single log file?

**URL:** https://discuss.elastic.co/t/what-is-the-grok-expression-that-can-match-variable-length-documents-from-a-single-log-file/285320
**Category:** Logstash
**Created:** [September 28, 2021, 7:48am UTC](https://discuss.elastic.co/t/what-is-the-grok-expression-that-can-match-variable-length-documents-from-a-single-log-file/285320 "2021-09-28T07:48:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shi](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@shi](https://discuss.elastic.co/u/shi)
#### Post date: [September 28, 2021, 7:48am UTC](https://discuss.elastic.co/t/what-is-the-grok-expression-that-can-match-variable-length-documents-from-a-single-log-file/285320/1 "2021-09-28T07:48:52Z")

</div>

A log file is having records of different leighths, say 3 different types of records?  
what is the grok expression that can match variable length documents from a single log file?

This will be very useful for creating index and ingest node for it via the interface provided by kibana (upload sample file)

regards  
shini

---

<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 25, 2021, 7:32pm UTC](https://discuss.elastic.co/t/what-is-the-grok-expression-that-can-match-variable-length-documents-from-a-single-log-file/285320/2 "2021-10-25T19:32:41Z")

</div>

This is really hard to answer without any example data. grok matches fields regular expressions. A regexp can match literally anything.

---

<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 22, 2021, 7:33pm UTC](https://discuss.elastic.co/t/what-is-the-grok-expression-that-can-match-variable-length-documents-from-a-single-log-file/285320/3 "2021-11-22T19:33:00Z")

</div>

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