# Grok can't do what dissect does

**URL:** <https://discuss.elastic.co/t/grok-cant-do-what-dissect-does/156134>\
**Category:** Logstash\
**Created:** [November 10, 2018, 12:28pm UTC](https://discuss.elastic.co/t/grok-cant-do-what-dissect-does/156134 "2018-11-10T12:28:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aruntracer](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@aruntracer](https://discuss.elastic.co/u/aruntracer)\
**Post date:** [November 10, 2018, 12:28pm UTC](https://discuss.elastic.co/t/grok-cant-do-what-dissect-does/156134/1 "2018-11-10T12:28:14Z")

</div>

test.log

```
Sat Nov 30 21:36:25 IST 2013;404112130710695;8377828305;ROHIT KUMAR;0,PM - Prepaid Mercury,5401;11166;Del_Delhi_South Delhi_SD_IBC_T3_Terminal_Intern_166_5401

```

this log is easily parsed using dissect filter by giving the delimiter as semicolon, but when it come to Grok approach I feel it is not possible to get the value "0,PM - Prepaid Mercury,5401" which is the plan name of this customer because in grok I don't find an option to get the word which has spaces in between and numbers in between..

My Grok try,

```
%{DAY:day} %{MONTH:month} %{POSINT:date} %{TIME:time} %{WORD:time_zone} %{NUMBER:year};%{NUMBER:sim_number};%{NUMBER:tn};%{WORD:first_name}%{SPACE}%{WORD:last_name};%{?????:plan_name}

```

In above example Grok pattern I have given ????? in the place where I'm unable to extract the plan name from the log

---

<div class="post-metadata">

**Author:** ![Makra](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Makra](https://discuss.elastic.co/u/Makra)\
**Post date:** [November 10, 2018, 1:17pm UTC](https://discuss.elastic.co/t/grok-cant-do-what-dissect-does/156134/2 "2018-11-10T13:17:47Z")

</div>

@aruntracer

Use GREEDYDATA along with appropriate delimiter to fetch the plan like below.

`%{DAY:day} %{MONTH:month} %{POSINT:date} %{TIME:time} %{WORD:time_zone} %{NUMBER:year}\;%{NUMBER:sim_number}\;%{NUMBER:tn}\;%{WORD:first_name}%{SPACE}%{WORD:last_name}\;%{GREEDYDATA:plan_name}\;%{INT:num}\;%{NOTSPACE:remaining1} %{NOTSPACE:remaining2}`

The above grok will fetch the plan name follows:

```
 "plan_name": [
    [
      "0,PM - Prepaid Mercury,5401"
    ]
```

---

<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:** [December 8, 2018, 1:17pm UTC](https://discuss.elastic.co/t/grok-cant-do-what-dissect-does/156134/3 "2018-12-08T13:17:48Z")

</div>

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