In Logstash, when a log of a certain time is processed, I want Logstash to do an HTTP POST to a webserver, sending JSON. However, it's giving me errors and won't start logstsh. I'm assuming it doesn't like the ' around the JSON data that is part of the message. FOOIP is a variable with the IP Address found in the Log. Any help would be great
Logstash config file....
output{
if [type]=="FOO"{
http {
format=>"json"
http_method=>"post"
url=>"http://192.168.1.10/bar"
message=>"{'target':{'IPAddress':'"%{FOOIP}"},'commandName':'Test'}"
}
}
The http
output when format is set to json
will post the whole event in json
to the web service (so it will ignore the message piece you have set). So if you want it to work with the exact message that you are setting, try changing to format=message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With