Config file structure for http output plugin (Getting 400)


(V B) #1

My events are json with about 4-5 top level fields. I am using the http output plugin to send the events to an http endpoint running on my Flask app. However, I am getting a 400 error code for each event sent. I am not sure whats wrong. Its also quite hard to find help on the different parts of the http output options. I am not sure how to structure the config files. Currently all I have are the "url" and "http_method" fields set. I used a "json" input codec so the events should already be in a json format.

Any help or suggestion is appreciated, I am willing to try anything. My config file is as follows :

input {
	twitter {
		consumer_key => ""
		consumer_secret => ""
		oauth_token => ""
		oauth_token_secret => ""	
		full_tweet => true
		use_samples => true
		codec => json
		}
}
filter {
	if [coordinates] {

	}
	else {

	drop {}

	}
	
	prune {

	whitelist_names => ["^coordinates", "^created_at", "^favorite_count", "^lang$", "^place", "^possibly_sensitiv$e", "^retweet_count$", "^text$", "timestamp"]
	}
}


output{
	http {
		url => "http://app.herokuapp.com"
		http_method => "POST"

	}
}

(V B) #2

For anyone that comes across this error later, it had nothing to do with Logstash. My config file was alright. The problem was in my server side code to process these POST requests. I was using the Flask microframework and it puts up POST requests data usually inside the request.form attribute HOWEVER the logstash data was not there (for whatever reason).

The Logstash event data was in the request.data attribute that stores the POST data as a string.
If you want to check if this might be causing your error, you can print out the request.form attribute and see if the dict is empty.


(system) #3

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