# Send json to My URL from logstash

**URL:** https://discuss.elastic.co/t/send-json-to-my-url-from-logstash/151305
**Category:** Logstash
**Created:** [October 6, 2018, 8:55am UTC](https://discuss.elastic.co/t/send-json-to-my-url-from-logstash/151305 "2018-10-06T08:55:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![robindeshwal](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@robindeshwal](https://discuss.elastic.co/u/robindeshwal)
#### Post date: [October 6, 2018, 8:55am UTC](https://discuss.elastic.co/t/send-json-to-my-url-from-logstash/151305/1 "2018-10-06T08:55:20Z")

</div>

Hi,

I need to send the logs from nagios core to my API URL, I am using HTTP plugin for send the data.

I am tring to send the json formatted data, but logstgash not send the data in json it send the data in the string.

here is my output logstash pipeline code:  
http{   
url =\> "[http://localhost:8001/data/](http://localhost:8001/data/)"  
http\_method =\> ["post"]  
mapping =\> {  
"host" =\> "XXX.XX.XX.XX"  
"type" =\> "nagios\_log"  
"data" =\> "{'nagios\_type': '%{nagios\_type}', 'nagios\_hostname': '%{nagios\_hostname}', 'nagios\_service': '%{nagios\_service}'}"  
}  
}

i got the json data at my machine like this:  
{'host': '172.16.10.81', 'type': 'nagios\_log', 'data': "{'nagios\_type': 'SERVICE ALERT', 'nagios\_hostname': 'Router\_192.168.0.250\_\_SA', 'nagios\_service': 'GigabitEthernet 0/1 ifCRC' }"}

In this output i got value of data as string but i want this as json not string.

Can anyone help me to solve this issue.

Thank you

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 9, 2018, 8:22pm UTC](https://discuss.elastic.co/t/send-json-to-my-url-from-logstash/151305/2 "2018-10-09T20:22:26Z")

</div>

You're not sending JSON data. In JSON strings are double-quoted.

---

<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: [November 6, 2018, 8:22pm UTC](https://discuss.elastic.co/t/send-json-to-my-url-from-logstash/151305/3 "2018-11-06T20:22:27Z")

</div>

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