# "\_jsonparsefailure" Getting Error while reading messages from RabbitMQ

**URL:** <https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690>\
**Category:** Logstash\
**Created:** [April 9, 2021, 9:41am UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690 "2021-04-09T09:41:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![padamrai](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@padamrai](https://discuss.elastic.co/u/padamrai)\
**Post date:** [April 9, 2021, 9:41am UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690/1 "2021-04-09T09:41:58Z")

</div>

I am reading messages from rabbitmq while running the config file getting error "jsonparsefailure".  
message like "You have withdrawn RS. xxxfrom ATM.", "You are welcome again", etc...  
My config file:  
input {  
rabbitmq {  
host =\> "localhost"  
port =\> 5672  
user =\> "guest"  
password =\> "guest"  
durable =\> true  
queue =\> "test-queue"  
}  
}  
filter{  
json{  
source =\> "message"  
}  
}  
output {  
# elasticsearch {  
# hosts =\> "localhost:9200"  
# }  
stdout {  
codec =\> rubydebug  
}  
}

---

<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 9, 2021, 3:15pm UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690/2 "2021-04-09T15:15:13Z")

</div>

> [@padamrai](#):
>
> message like "You have withdrawn RS. xxxfrom ATM.", "You are welcome again", etc...

That is not valid JSON, so a \_jsonparsefailure tag would be expected. What is your question?

---

<div class="post-metadata">

**Author:** ![padamrai](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@padamrai](https://discuss.elastic.co/u/padamrai)\
**Post date:** [April 9, 2021, 3:32pm UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690/3 "2021-04-09T15:32:54Z")

</div>

Yes, I know this is not JSON. The first time I run without JSON in the filter then I got an error \_jsonparsefailure then I put JSON plugin inside the filter. I need how to solve this problem.

---

<div class="post-metadata">

**Author:** ![padamrai](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@padamrai](https://discuss.elastic.co/u/padamrai)\
**Post date:** [April 9, 2021, 3:34pm UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690/4 "2021-04-09T15:34:27Z")

</div>

input {  
rabbitmq {  
host =\> "localhost"  
port =\> 5672  
user =\> "guest"  
password =\> "guest"  
durable =\> true  
queue =\> "test-queue"  
}  
}

output {  
elasticsearch {  
hosts =\> "localhost:9200"  
}  
stdout {  
codec =\> rubydebug  
}  
}  
still getting \_jsonparsefailure error.

---

<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 9, 2021, 3:45pm UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690/5 "2021-04-09T15:45:28Z")

</div>

The [default codec](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-rabbitmq.html#plugins-inputs-rabbitmq-codec) for a rabbitmq is json. So you will need to specify a codec on the input. plain or line, perhaps, it really depends on your data format.

---

<div class="post-metadata">

**Author:** ![padamrai](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@padamrai](https://discuss.elastic.co/u/padamrai)\
**Post date:** [April 9, 2021, 3:52pm UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690/6 "2021-04-09T15:52:57Z")

</div>

"You have withdrawn RS. xxx from ATM.",  
"You are welcome again"  
I have such type of messages in rabbitmq I need to read in logstash. But getting JSON error. So How I can resolve this issue?

---

<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 9, 2021, 4:25pm UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690/7 "2021-04-09T16:25:47Z")

</div>

You will need to specify a codec on the input. plain or line, perhaps, it really depends on your data format. line should work if the messages have a trailing newline, plain if they do not.

---

<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 7, 2021, 4:25pm UTC](https://discuss.elastic.co/t/jsonparsefailure-getting-error-while-reading-messages-from-rabbitmq/269690/8 "2021-05-07T16:25:54Z")

</div>

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