# Need help on Grok Filter?

**URL:** <https://discuss.elastic.co/t/need-help-on-grok-filter/187227>\
**Category:** Logstash\
**Created:** [June 25, 2019, 5:24am UTC](https://discuss.elastic.co/t/need-help-on-grok-filter/187227 "2019-06-25T05:24:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shankarananth](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@shankarananth](https://discuss.elastic.co/u/shankarananth)\
**Post date:** [June 25, 2019, 5:24am UTC](https://discuss.elastic.co/t/need-help-on-grok-filter/187227/1 "2019-06-25T05:24:33Z")

</div>

Hai All,

I'm newbie to ELK.  
I need to write a grok command to separate below value. Have some challenges in achieving it.

Value = uda:eop:de:solu:400003112342.E\_BADF\_COE\_009\_003.DI poc

grok command =%{WORD:line1}:%{WORD:line}:%{WORD:stnd}:%{WORD:identification}:%{BASE10NUM:Assetnumber}.%{WORD:verb}

I have a problem in splitting the following value(E\_BADF\_COE\_009\_003.DI poc). When i write a grok command it's taking it as a single value(E\_BADF\_COE\_009\_003). Instead of taking it as a single value. I need to split it and store it in separate fields(EG:%{WORD:verb1}%{WORD:verb2}%{WORD:verb3} )  
Verb1:E  
Verb2:BADF  
Verb3:COE  
etc  
Guide me how to do it ..

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![sjabiulla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sjabiulla/32/48429_2.png) [@sjabiulla](https://discuss.elastic.co/u/sjabiulla)\
**Post date:** [June 25, 2019, 6:19am UTC](https://discuss.elastic.co/t/need-help-on-grok-filter/187227/2 "2019-06-25T06:19:30Z")

</div>

Hi,

I'm not soo good with GROK filter. You can use the mutate filter after the grok as below to split the verb field.

```
grok
	{
		match => { "message" => "%{WORD:line1}:%{WORD:line}:%{WORD:stnd}:%{WORD:identification}:%{BASE10NUM:Assetnumber}.%{WORD:verb}"}
	}

	mutate {
 split => { "verb" => "_" }
 add_field => { "verb1" => "%{verb[0]}" }
 add_field => { "verb2" => "%{verb[1]}" }
 add_field => { "verb3" => "%{verb[2]}" }

```

}

---

<div class="post-metadata">

**Author:** ![kirangavali](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@kirangavali](https://discuss.elastic.co/u/kirangavali)\
**Post date:** [June 25, 2019, 9:28am UTC](https://discuss.elastic.co/t/need-help-on-grok-filter/187227/3 "2019-06-25T09:28:25Z")

</div>

Hi @shankarananth

You can use the below "logstash.conf" file for splitting the value.

logstash.conf

> input { stdin { } }
> 
> filter {  
> mutate {  
> split =\> { "message" =\> "\_" }  
> }  
> }
> 
> output {  
> stdout { codec =\> rubydebug }  
> }

I executed with above "logstash.conf" and got the below output.  
May this will help you.

> $ bin/logstash -f /etc/logstash/conf.d/logstash.conf

> uda:eop:de:solu:400003112342.E\_BADF\_COE\_009\_003.DI poc  
> {  
> "host" =\> "localhost",  
> "@timestamp" =\> 2019-06-25T09:21:52.720Z,  
> "@version" =\> "1",  
> "message" =\> [  
> [0] "uda:eop:de:solu:400003112342.E",  
> [1] "BADF",  
> [2] "COE",  
> [3] "009",  
> [4] "003.DI poc"  
> ]  
> }

Thanks,  
Kiran

---

<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:** [July 23, 2019, 9:28am UTC](https://discuss.elastic.co/t/need-help-on-grok-filter/187227/4 "2019-07-23T09:28:29Z")

</div>

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