# JSON Parsing failure on logstash

**URL:** https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156
**Category:** Logstash
**Created:** [November 26, 2018, 11:08am UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156 "2018-11-26T11:08:09Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 26, 2018, 11:08am UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156/1 "2018-11-26T11:08:09Z")

</div>

HI,  
I have json when i try to index those logs into elasticsearch. When i apply json filter some logs are omitted to get index on ES. when i command those json filter i can index those event into ES. i have validated that json input into "[https://jsonlint.com/](https://jsonlint.com/)" and it shows valid json. Please find my input and error message which i got,

If i enable the json filter im getting this error , if i disable i'm not getting this error

Input:

`{"version":"1.0.0","environment":{"name":"E1","hostName":"txnmessaging-deployment-11-g1d77","virtualMachine":"na","clusterName":"txnmessaging","containerId":"na","containerName":"na","containerType":"OPENSHIFT-JAVA"},"application":{"project":"rtpe","portfolio":"payment-network","name":"txnmessaging"},"type":"EVENT","level":"INFO","message":"Txn Log Messaging is up and running!","fileName":"com.amex.txnlog.handler.HealthCheckHandler","methodName":"checkHealth","lineNumber":25,"thread":"38-nmsworkerverticle-1","timestamp":"2018-11-22T02:40:56.012Z","correlationId":"txnmessaging-deployment-11-g1d77-096980c0-ee00-11e8-b0e4-a7ed1c84c14e","additionalFields":{"X-AXP-UUID":"txnmessaging-deployment-11-g1d77-096980c0-ee00-11e8-b0e4-a7ed1c84c14e","APP_VERSION":"missing app version"}}`

Error:

```
[2018-11-26T10:38:01,725][WARN][logstash.filters.json] Error parsing json {:source=>"lomo_msg", :raw=>"{\"app_name\": \"client-state-mgr\", \"pod_ip\": \"192.168.33.25\", \"time\": \"2018-11-26T10:37:53.885807547Z\", \"environment\": \"e1\", \"pod_name\": \"client-state-mgr-deployment-23-lr3n2\", \"container_name\": \"k8s_client-state-mgr_client-state-mgr-deployment-23-lr3n2_nemo-demo_abdfdb1a-e9d0-11e8-813d-fa163e7ac2b7_14\", \"message\": \"\tat akka.persistence.AbstractPersistentActor.aroundReceive(PersistentActor.scala:454) ~[client-state-management-local-dev-SNAPSHOT-all.jar:?]\", \"ns\": \"nemo-demo\", \"pod_container\": \"client-state-mgr\"}", :exception=>#<LogStash::Json::ParserError: Illegal unquoted character ((CTRL-CHAR, code 9)): has to be escaped using backslash to be included in string value
 at [Source: (byte[])"{"app_name": "client-state-mgr", "pod_ip": "192.168.33.25", "time": "2018-11-26T10:37:53.885807547Z", "environment": "e1", "pod_name": "client-state-mgr-deployment-23-lr3n2", "container_name": "k8s_client-state-mgr_client-state-mgr-deployment-23-lr3n2_nemo-demo_abdfdb1a-e9d0-11e8-813d-fa163e7ac2b7_14", "message": " at akka.persistence.AbstractPersistentActor.aroundReceive(PersistentActor.scala:454) ~[client-state-management-local-dev-SNAPSHOT-all.jar:?]", "ns": "nemo-demo", "pod_container": "cli"[truncated 15 bytes]; line: 1, column: 318]>}
```

---

<div class="post-metadata">

### Author: ![Eniqmatic](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@Eniqmatic](https://discuss.elastic.co/u/Eniqmatic)
#### Post date: [November 26, 2018, 11:36am UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156/2 "2018-11-26T11:36:28Z")

</div>

It seems the issue lies with the "message" field, are you sure there is not another log that has a quote inside the message field?

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 26, 2018, 11:59am UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156/3 "2018-11-26T11:59:39Z")

</div>

> [@Eniqmatic](#):
>
> It seems the issue lies with the "message" field

if i replace the "message" keyword into "msg" by using gsub it will work or not?

---

<div class="post-metadata">

### Author: ![Eniqmatic](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@Eniqmatic](https://discuss.elastic.co/u/Eniqmatic)
#### Post date: [November 26, 2018, 12:02pm UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156/4 "2018-11-26T12:02:50Z")

</div>

I think it is saying that within the message field that there is an extra quote mark that has not been escaped, therefor it causes it to think there is an extra quotation. Are you sure that the input you posted above is the one causing an error?

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 26, 2018, 12:08pm UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156/5 "2018-11-26T12:08:41Z")

</div>

> [@Eniqmatic](#):
>
> I think it is saying that within the message field that there is an extra quote mark that has not been escaped,

I cross checked on my message and there is no extra quotes or new line.

> [@Eniqmatic](#):
>
> therefor it causes it to think there is an extra quotation. Are you sure that the input you posted above is the one causing an error?

yes i'm sure when i enable the json filter i'm getting this error on log.

---

<div class="post-metadata">

### Author: ![Eniqmatic](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@Eniqmatic](https://discuss.elastic.co/u/Eniqmatic)
#### Post date: [November 26, 2018, 12:14pm UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156/6 "2018-11-26T12:14:01Z")

</div>

The error and the message you are providing me do not match up, for example check the error log:

```
"container_name": "k8s_client-state-mgr_client-state-mgr-deployment-23-lr3n2_nemo-demo_abdfdb1a-e9d0-11e8-813d-fa163e7ac2b7_14"

```

Yet you are saying that input is:

```
"containerName":"na"

```

Notice the difference? So please provide the correct input

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 26, 2018, 1:03pm UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156/7 "2018-11-26T13:03:21Z")

</div>

> [@Eniqmatic](#):
>
> The error and the message you are providing me do not match up, for example check the error log:

`{"app_name": "client-state-mgr", "pod_ip": "192.168.33.25", "time": "2018-11-26T12:29:35.608142382Z", "environment": "e1", "pod_name": "client-state-mgr-deployment-23-lr3n2", "container_name": "k8s_client-state-mgr_client-state-mgr-deployment-23-lr3n2_nemo-demo_abdfdb1a-e9d0-11e8-813d-fa163e7ac2b7_14", "message": "	at akka.persistence.Eventsourced.aroundReceive(Eventsourced.scala:222) ~[client-state-management-local-dev-SNAPSHOT-all.jar:?]", "ns": "nemo-demo", "pod_container": "client-state-mgr"}`

---

<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 24, 2018, 1:03pm UTC](https://discuss.elastic.co/t/json-parsing-failure-on-logstash/158156/8 "2018-12-24T13:03:31Z")

</div>

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