# How to grok log file with different line formats

**URL:** <https://discuss.elastic.co/t/how-to-grok-log-file-with-different-line-formats/104289>\
**Category:** Logstash\
**Created:** [October 17, 2017, 6:09pm UTC](https://discuss.elastic.co/t/how-to-grok-log-file-with-different-line-formats/104289 "2017-10-17T18:09:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amoghmudkavi](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@amoghmudkavi](https://discuss.elastic.co/u/amoghmudkavi)\
**Post date:** [October 17, 2017, 6:09pm UTC](https://discuss.elastic.co/t/how-to-grok-log-file-with-different-line-formats/104289/1 "2017-10-17T18:09:17Z")

</div>

my input log file looks like ...

Infodom ABCDE  
RuleID 1481519674238  
BuildFlag false  
InfoDate 20160331  
TaskID Task25  
Optional Params "$RUNID=1481925973714,$PHID=XXXX\_FR2052A\_COMMON\_RULES,$EXEID=1482870457650,$RUNSK=8505"  
BatchRunExeID ABCDE\_1482870457650\_20160331\_1

How can i index this based on rule id, info date, task id etc... can somebody help me?

---

<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:** [October 17, 2017, 6:45pm UTC](https://discuss.elastic.co/t/how-to-grok-log-file-with-different-line-formats/104289/2 "2017-10-17T18:45:18Z")

</div>

What's the expected output of a file like the example above? Express the result you want as JSON.

---

<div class="post-metadata">

**Author:** ![amoghmudkavi](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@amoghmudkavi](https://discuss.elastic.co/u/amoghmudkavi)\
**Post date:** [October 17, 2017, 6:59pm UTC](https://discuss.elastic.co/t/how-to-grok-log-file-with-different-line-formats/104289/3 "2017-10-17T18:59:56Z")

</div>

Hi Magnus Bäck,

Thank you very much for helping me.

Output = elasticksearch  
but want to index on each of the line like ...  
Infodom  
RuleId  
BuildFlag  
InfoDate  
TaskID

But all these are on different lines on the same log file.

---

<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:** [October 17, 2017, 7:05pm UTC](https://discuss.elastic.co/t/how-to-grok-log-file-with-different-line-formats/104289/4 "2017-10-17T19:05:38Z")

</div>

Please show an example event that you'd like to see. Do not _describe_ it. Show a concrete JSON example.

---

<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 14, 2017, 7:06pm UTC](https://discuss.elastic.co/t/how-to-grok-log-file-with-different-line-formats/104289/5 "2017-11-14T19:06:00Z")

</div>

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