# Logstash parse strings before a valid json

**URL:** https://discuss.elastic.co/t/logstash-parse-strings-before-a-valid-json/294578
**Category:** Logstash
**Created:** [January 17, 2022, 11:59am UTC](https://discuss.elastic.co/t/logstash-parse-strings-before-a-valid-json/294578 "2022-01-17T11:59:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Calin\_Tatar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/calin_tatar/32/100405_2.png) [@Calin\_Tatar](https://discuss.elastic.co/u/Calin_Tatar)
#### Post date: [January 17, 2022, 11:59am UTC](https://discuss.elastic.co/t/logstash-parse-strings-before-a-valid-json/294578/1 "2022-01-17T11:59:58Z")

</div>

Hello, i have the following log : Received stock info for v2, payload: {'id': '1234dads', 'sku': '1QA0QWQ-1JFQQQ'} and i would like to add a new field with phase before json ,i tried the following config but is now working .

if "Received" in [information] and [kubernetes][namespace] == "namespace" {  
grok {  
match =\> ["information", "(?[^{]\*)"]  
}  
mutate { add\_field =\> { "payload\_msg" =\> "%{payload}"}}  
json {  
source =\> "information"  
}

Can you please let me know what is wrong ?

paylod = Received stock info for v2, payload: and after parse the information field using json

---

<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: [February 14, 2022, 12:00pm UTC](https://discuss.elastic.co/t/logstash-parse-strings-before-a-valid-json/294578/2 "2022-02-14T12:00:22Z")

</div>

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