Problem with http output

Hello,

I'm facing a problem with sending Input from SQL server to Power BI

input {
	jdbc { 
    		jdbc_connection_string => "jdbc:sqlserver://db.local:1433;database=test"
    		jdbc_user => "test"
		jdbc_password => "test"
    		jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
		jdbc_driver_library =>  "C:\Logstash\sqljdbc_4.2\enu\jre8\sqljdbc42.jar"
    		statement => "select top(2)id,eventdata,inserttime from BPADataPipelineInput with (rowlock, readpast)"
		schedule =>  "*/1 * * * *" 
	}
}

Getting input is working fine.

Output from:

stdout { codec => rubydebug }

{
    "inserttime" => 2019-09-11T06:24:16.567Z,
     "eventdata" => "{\"EventData\":{\"Source\":\"License\",\"Subject\":\"License Information\",\"Values\":[{\"Constraint\":\"Concurrent Sessions\",\"Limit\":52,\"Used\":0}]},\"EventType\":2}"
}

Then i'm trying to send it to Power BI API using Http module:

	http {
    	http_method => "post"
    	url => "https://api.powerbi.com/removedkey"
	content_type =>"application/json"
	format => "message"	
	message => '[{"eventdata" : "%{eventdata}" , "inserttime" : "%{inserttime}"}]'
	}

Output

[2019-09-20T10:06:01,947][WARN ][logstash.outputs.http    ] Encountered a retryable HTTP request in HTTP output, will retry {:code=>500, :body=>"{\"error\":{\"code\":\"RealTime_PushRowsInvalidJson\",\"pbi.error
\":{\"code\":\"RealTime_PushRowsInvalidJson\",\"parameters\":{},\"details\":[]}}}"}

When I put dummy data, like this
message => '[{"eventdata" : "test11" , "inserttime" : "%{inserttime}"}]'
Then its working...
any idea how should I format eventdata

managed to resolve it with dissect filter

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