Hi,
I'm trying to get data from an HTTP API, the main API needs a bearer token to authenticate, a secondary API gives me the token that allows the authentication in the main API. I Solved using http_poller input to get the token and then use HTTP filter to get the important data. But I can't find a way to use a bearer token in HTTP filter. This is my pipeline:
input {
http_poller {
urls => {
getToken => {
method => post
body => '{"username":"myusername", "password":"mypassword"}'
url => "http://myhost/rest-api/authenticate"
headers => {
Accept => "*/*"
"Content-Type" => "application/json"
}
}
}
request_timeout => 60
schedule => {
cron => "* * * * * UTC"
}
metadata_target => "http_poller_metadata"
}
}
filter {
http {
url => "http://myhost/rest-api/topology"
verb => "POST"
body => "ELKnode"
body_format => "json"
target_body => "fieldata"
authorization => "%{token}"
}
}
output {
stdout {
codec => json {
}
}
}
How can I give the bearer token to the HTTP filter? or If there is a better way to do this please tell me
Thanks