# GROK Pattern to split string to multiple values

**URL:** <https://discuss.elastic.co/t/grok-pattern-to-split-string-to-multiple-values/178636>\
**Category:** Logstash\
**Created:** [April 26, 2019, 11:37am UTC](https://discuss.elastic.co/t/grok-pattern-to-split-string-to-multiple-values/178636 "2019-04-26T11:37:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohanraj](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mohanraj](https://discuss.elastic.co/u/Mohanraj)\
**Post date:** [April 26, 2019, 11:37am UTC](https://discuss.elastic.co/t/grok-pattern-to-split-string-to-multiple-values/178636/1 "2019-04-26T11:37:04Z")

</div>

I am getting a string ".." in the logs and would like to split this using grok pattern. is there any method to do so ?  
example:  
input log string : java-app.ABCD.win-service-test  
Output should be  
app\_name: java-app  
org\_name: ABCD  
service\_name: win-service-test

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [April 26, 2019, 4:25pm UTC](https://discuss.elastic.co/t/grok-pattern-to-split-string-to-multiple-values/178636/2 "2019-04-26T16:25:37Z")

</div>

Hey @Mohanraj, is your question in regard to the grok filter plugin in Logstash? If so, I can move this topic over to the Logstash section.

---

<div class="post-metadata">

**Author:** ![Mohanraj](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mohanraj](https://discuss.elastic.co/u/Mohanraj)\
**Post date:** [April 26, 2019, 4:48pm UTC](https://discuss.elastic.co/t/grok-pattern-to-split-string-to-multiple-values/178636/3 "2019-04-26T16:48:22Z")

</div>

Yes Brandon, this is related to the grok filter pattern.

Thanks,

Mohan

---

<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:** [April 26, 2019, 5:24pm UTC](https://discuss.elastic.co/t/grok-pattern-to-split-string-to-multiple-values/178636/4 "2019-04-26T17:24:14Z")

</div>

```
grok { match => { "message" => "(?<app_name>[^.]*)\.(?<org_name>[^.]*)\.(?<service_name>[^.]*)" } }

```

would do it.

---

<div class="post-metadata">

**Author:** ![Mohanraj](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mohanraj](https://discuss.elastic.co/u/Mohanraj)\
**Post date:** [April 29, 2019, 6:07am UTC](https://discuss.elastic.co/t/grok-pattern-to-split-string-to-multiple-values/178636/5 "2019-04-29T06:07:38Z")

</div>

Hi Badger, Thank you, this works fine.

---

<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:** [May 27, 2019, 6:07am UTC](https://discuss.elastic.co/t/grok-pattern-to-split-string-to-multiple-values/178636/6 "2019-05-27T06:07:42Z")

</div>

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