# Groking Issue with Multiple data formats

**URL:** <https://discuss.elastic.co/t/groking-issue-with-multiple-data-formats/85018>\
**Category:** Logstash\
**Created:** [May 9, 2017, 6:29am UTC](https://discuss.elastic.co/t/groking-issue-with-multiple-data-formats/85018 "2017-05-09T06:29:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamran.matloob](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kamran.matloob](https://discuss.elastic.co/u/kamran.matloob)\
**Post date:** [May 9, 2017, 6:29am UTC](https://discuss.elastic.co/t/groking-issue-with-multiple-data-formats/85018/1 "2017-05-09T06:29:14Z")

</div>

Hi here !

I have multiple formats in one file to grok.Below is the one type of data  
2017-03-23 08:51:43,088 INFO [ActiveMQ Session Task-142] INVOICE02-SAP Vendor Number: SAP Vendor Number Query Result [{DUNS\_ID=750944209, SAP\_VENDOR\_NUMBER=301183}]  
Which is running fine with the below grok  
%{TIMESTAMP\_ISO8601:coffii\_timestamp}\s\*%{LOGLEVEL:logtype}\s\*[%{DATA:task\_descriptor}?]\s\*%{GREEDYDATA:coffii\_message}

But when I run on this format of data  
2017-03-23 08:51:42,913 INFO [[order-processing-1.0.9.1-v20150131-00+20].Vendor-Email-Flow.stage1.32] org.mule.api.processor.LoggerMessageProcessor:  
the task\_descriptor is not getting proper value. it returns "[order-processing-1.0.9.1-v20150131-00+20" but I need it to return "[[order-processing-1.0.9.1-v20150131-00+20].Vendor-Email-Flow.stage1.32]"

If i changed DATA:task\_descriptor to GREEDYDATA:task\_descriptor as shown below  
%{TIMESTAMP\_ISO8601:coffii\_timestamp}\s\*%{LOGLEVEL:logtype}\s\*[%{GREEDYDATA:task\_descriptor}?]\s\*%{GREEDYDATA:coffii\_message}  
then above issue is resolved but first format of data is not coming through properly. Everything after the "INFO" field ends up the task\_descriptor field, instead of just the "[ActiveMQ Session Task-142]" piece.  
Kindly advise.

Tested above on "[https://grokdebug.herokuapp.com/](https://grokdebug.herokuapp.com/)"

---

<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:** [May 9, 2017, 6:54am UTC](https://discuss.elastic.co/t/groking-issue-with-multiple-data-formats/85018/2 "2017-05-09T06:54:01Z")

</div>

`\s*` means "zero or more whitespace characters", which isn't correct in your case since you really want there to be a space before and after the log level (for example). Use `\s+` for "one or more whitespace characters" instead.

---

<div class="post-metadata">

**Author:** ![kamran.matloob](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kamran.matloob](https://discuss.elastic.co/u/kamran.matloob)\
**Post date:** [May 15, 2017, 8:36pm UTC](https://discuss.elastic.co/t/groking-issue-with-multiple-data-formats/85018/3 "2017-05-15T20:36:19Z")

</div>

[Thanks.So](http://Thanks.So) nice of [you.My](http://you.My) issue resolved.

---

<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:** [June 12, 2017, 8:39pm UTC](https://discuss.elastic.co/t/groking-issue-with-multiple-data-formats/85018/4 "2017-06-12T20:39:33Z")

</div>

Closed on June 12, 2017, 8:39pm UTC

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