Basic http_poller question with REST API

Hello, I read all posts for similar issues and still unable to get the output correctly from http_poller and REST API.
Not sure what I am missing and how to display the metadata or the JSON fields correctly.
When this works, I will then try to push this into elasticsearch.
Thanks in advance !

Here is my logstash.conf:

    input {
            http_poller {
                    urls => {
                      url1 => "https://api-fxpractice.oanda.com/v1/candles?instrument=EUR_USD&granularity=D&count=1&candleFormat=midpoint"
                    } # end urls
                    schedule => { "every" => "1m" }
                    codec => "json"
                    metadata_target => "http_poller_metadata"
            } # end http input
    }
    }
    output {
            stdout { }
    }

When running this I get the output:
2017-11-24T21:42:18.232Z %{host} %{message}

JD

That format of output is the result of a rather unhelpful to_s method on the event class.

To get a full representation of the event in the console use the rubydebug codec in stdout output.

  stdout { codec => rubydebug { metadata => true } }

See https://www.elastic.co/guide/en/logstash/current/plugins-codecs-rubydebug.html#plugins-codecs-rubydebug

Thank you, that worked. I'll post my next question (splitting JSON array) separately.

1 Like

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