Problem with logstash http_poller plugin


(Kabali12345) #1

Hi all here i am trying to call rest API with http_poller plugin.
Here is my logstash conf

input {
  http_poller {
    urls => {
      test2 => {
        method => get
        user => "XXXX"
        password => "XXXX"
        url => "https://XXX.XXX.XXX.XXX:8021/api/v2/alerts"
        headers => {
          Accept => "application/json"
        }
     }
    }
    request_timeout => 60
    schedule => { cron => "* * * * * UTC"}
    codec => "json"
    metadata_target => "http_poller_metadata"
#    verify_cert => true
#    ssl_certificate_validation => true
 #   truststore => "/root/truststore.jks"
  #  truststore_password => "access"
  }
}

output {
  stdout {
    codec => rubydebug
  }
}

where i am getting following error in result of logstash

[2018-02-16T10:59:10,216][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9601}
{
    "http_request_failure" => {
                "request" => {
            "headers" => {
                "Accept" => "application/json"
            },
             "method" => "get",
               "auth" => {
                "eager" => true,
                 "pass" => "XXXX",
                 "user" => "XXXX"
            },
                "url" => "https://XXX.XXX.XXX.XXX:8021/api/v2/alerts"
        },
              "backtrace" => nil,
        "runtime_seconds" => 0.861,
                   "name" => "test2",
                  "error" => **"PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"**
    },
              "@timestamp" => 2018-02-16T16:00:01.176Z,
                "@version" => "1",
    "http_poller_metadata" => {
                "request" => {
            "headers" => {
                "Accept" => "application/json"
            },
             "method" => "get",
               "auth" => {
                "eager" => true,
                 "pass" => "XXXX",
                 "user" => "XXXX"
            },
                "url" => "https://XXX.XXX.XXX.XXX:8021/api/v2/alerts"
        },
        "runtime_seconds" => nil,
                   "name" => "test2",
                   "host" => "sgplubuntu1604"
    },
                    "tags" => [
        [0] "_http_request_failure"
    ]
}

i have also tried to add truststore files in configuration but still am getting same error.
but same configuration is working for HTTP Protocol, where i have used elasticsearch rest api http://XXX.XXX.XXX.XXX:9233/_cluster/health/.

did i miss something here in my logstash conf...?

Thank You.


(Kabali12345) #2

Hi all is there any work around this error...?


(system) #3

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