Send json to My URL from logstash


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:
url => "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': '', '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

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

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