# Parsing the string with not specific delimeters

**URL:** <https://discuss.elastic.co/t/parsing-the-string-with-not-specific-delimeters/66683>\
**Category:** Logstash\
**Created:** [November 21, 2016, 8:20am UTC](https://discuss.elastic.co/t/parsing-the-string-with-not-specific-delimeters/66683 "2016-11-21T08:20:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![saisn](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@saisn](https://discuss.elastic.co/u/saisn)\
**Post date:** [November 21, 2016, 8:20am UTC](https://discuss.elastic.co/t/parsing-the-string-with-not-specific-delimeters/66683/1 "2016-11-21T08:20:35Z")

</div>

I have a field which is of type string and holds a log data from which i need to identify specific fields as below. what could be the best way to do this when string doesn't have a fixed delimiter

"Log": "2016-01-01T00:00:12|DEBUG|89ID:701Task':  
ID=701125351 wayID=666 iceID=688 UID=733008 MID=00D089DE DName=null  
......................................

the data above is stored in a field called outputdata. I have to read a field like UID=733008 from it. Is there a way in logstash that can read the matching words as UID and save that UID field in a index.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 21, 2016, 8:33am UTC](https://discuss.elastic.co/t/parsing-the-string-with-not-specific-delimeters/66683/2 "2016-11-21T08:33:21Z")

</div>

Use a [grok filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html) to first parse out all the fields up to and including the colon. Parse and store the rest in a variable using a GREEDYDATA pattern. You can then apply a [kv filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-kv.html) to parse the key-value list.

---

<div class="post-metadata">

**Author:** ![saisn](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@saisn](https://discuss.elastic.co/u/saisn)\
**Post date:** [November 21, 2016, 8:47pm UTC](https://discuss.elastic.co/t/parsing-the-string-with-not-specific-delimeters/66683/3 "2016-11-21T20:47:19Z")

</div>

i dont have a fixed length delimiter here some has tab some has few spaces. In kv the default delimeter is " ". how can i fix in such a situation

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 21, 2016, 9:11pm UTC](https://discuss.elastic.co/t/parsing-the-string-with-not-specific-delimeters/66683/4 "2016-11-21T21:11:41Z")

</div>

You could perhaps pre-process the kv list with a [mutate gsub filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-gsub) to replace all tabs with spaces?

---

<div class="post-metadata">

**Author:** ![saisn](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@saisn](https://discuss.elastic.co/u/saisn)\
**Post date:** [November 22, 2016, 6:05pm UTC](https://discuss.elastic.co/t/parsing-the-string-with-not-specific-delimeters/66683/5 "2016-11-22T18:05:56Z")

</div>

Sorry, but 'tab' is not a delimiter here.  
The delimiter is actually some variable number of spaces.

---

<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 20, 2016, 6:06pm UTC](https://discuss.elastic.co/t/parsing-the-string-with-not-specific-delimeters/66683/6 "2016-12-20T18:06:39Z")

</div>

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