Http_poller help including headers


#1

update... I figured out the header issue.

I added a new line to the headers section like this.

 headers => {
           Accept => "application/json"
	   "Authorization" => "Bearer  <api_token."

}

I am using Yahoo's flurry api to get mobile app data.

Per Yahoo: the programatic token should be included in the header as: Authorization: Bearer <api_token>

I tested it using ARC rest client and got it to work.

I would like to use logstash's http_poller and looking for help on how to include that custom header.

This what I have so far for the http_poller config which makes the connection, but fails b/c its not sending expected header.

input {
  http_poller {
    urls => {
       test => {
        # Supports all options supported by ruby's Manticore HTTP client
        method => get
        url => "https://api-metrics.flurry.com/public/v1/data/..."
        headers => {
           Accept => "application/json"
        }
        
      }
    }
    request_timeout => 60
    # Supports "cron", "every", "at" and "in" schedules by rufus scheduler
    # schedule => { cron => "* * * * * UTC"}
    schedule => { every => "1h"}
    # codec => "json"
    # A hash of request metadata info (timing, response headers, etc.) will be sent here
    metadata_target => "http_poller_metadata"
  }
}

 output {
stdout {
 codec => rubydebug
 }
  }

Thanks,
Frank


(system) #2

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