Update Config and Error:
input {
http_poller {
urls => {
test1 => {
method => "POST"
user => "abc"
password => "xyz"
url => "http://..**.123:9200/_sql?format=txt"
body => '{"query": "SELECT id, name FROM testindex"}'
headers => {Accept => "application/json"}
}
}
request_timeout => 60
schedule => { cron => "* * * * * UTC"}
codec => "json"
metadata_target => "http_poller_metadata"
}
}
output {
#stdout {}
elasticsearch {
hosts => ["http://..**.123:9200"]
user => "abc"
password => "xyz"
index => "testDest"
}
}
Error:--->
[2021-02-25T10:45:57,893][INFO ][logstash.javapipeline ][main] Pipeline started {"pipeline.id"=>"main"}
[2021-02-25T10:45:57,973][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>}
[2021-02-25T10:45:58,479][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
C:/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/cronline.rb:77: warning: constant ::Fixnum is deprecated
{
"error" => "Content-Type header [text/plain; charset=ISO-8859-1] is not supported",
"status" => 406,
"@version" => "1",
"@timestamp" => 2021-02-25T05:16:00.481Z,
"http_poller_metadata" => {
"host" => "IN-ABCD",
"request" => {
"auth" => {
"user" => "abc",
"eager" => true,
"pass" => "xyz"
},
"method" => "post",
"url" => "http://...:9200/_sql?format=txt",
"body" => "{"query": "SELECT * FROM rpalogpoc"}",
"headers" => {
"Accept" => "application/json"
}
},
"response_message" => "Not Acceptable",
"response_headers" => {
"content-type" => "application/json; charset=UTF-8"
},
"name" => "test1",
"runtime_seconds" => 0.204,
"times_retried" => 0,
"code" => 406
}
}