# Parse Substring to JSON

**URL:** <https://discuss.elastic.co/t/parse-substring-to-json/291333>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [December 9, 2021, 1:50pm UTC](https://discuss.elastic.co/t/parse-substring-to-json/291333 "2021-12-09T13:50:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hami2608](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@hami2608](https://discuss.elastic.co/u/hami2608)\
**Post date:** [December 9, 2021, 1:50pm UTC](https://discuss.elastic.co/t/parse-substring-to-json/291333/1 "2021-12-09T13:50:06Z")

</div>

Hi,

i have a Droptailer Pod in my Kubernetes Cluster with the following log example:

> 2021-12-09 13:46:32 +0000 UTC {"DPT":"161","DST":"XXX.XXX.XXX.XXX","ID":"54321","IN":"vrf104009","LEN":"48","MAC":"XX:XX:XX:XX:XX:XX:XX:XX:XX:XX","OUT":"vlan1000","PREC":"0x00","PROTO":"UDP","SPT":"39002","SRC":"YY.YY.YY.YY","TOS":"0x00","TTL":"242","timestamp":"2021-12-09 13:46:32 +0000 UTC"}

Now i fail by parsing the json part from the logentry becouse of the timestamp in front of it.  
How can i get the JSON in a proper format?

Thx!

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [December 9, 2021, 4:09pm UTC](https://discuss.elastic.co/t/parse-substring-to-json/291333/2 "2021-12-09T16:09:05Z")

</div>

Send the data to a logstash instance and then there you can create a grok pattern to filter out the timestamp and then just recognize the JSON afterwards.

A grok pattern like this should work

```auto
%{DATE} %{TIME} \+0000 UTC %{GREEDYDATA:json_data}

```

Then use the JSON filter to parse the json\_data field.

---

<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:** [January 6, 2022, 6:09pm UTC](https://discuss.elastic.co/t/parse-substring-to-json/291333/3 "2022-01-06T18:09:23Z")

</div>

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