Using global method and headers for http_poller multiple urls

Hello,

Having trouble to use global method GET and headers for multiple urls call.

Copilot told me that it is possible, but it doesn't work in my case.

This is my configuration :


input {
	http_poller {
		urls => {

			gff => {
                url => "http://bitbucket.serv.cdc.fr/rest/api/latest/projects/GFF/repos/?limit=1000"
            }

            x1 => {
                url => "http://bitbucket.serv.cdc.fr/rest/api/latest/projects/X1/repos/?limit=1000"
            }

		}

		method => "GET"
		
		headers => {
			Accept => "application/json"
			Authorization => "Bearer ${BITBUCKET_TOKEN}"
		}

		schedule => {
			cron => "${BITBUCKET_DEV_REPO_CRON}" 
		}

		codec => "json"
	}
}

I get this error :

[ERROR][logstash.inputs.http_poller] Unknown setting 'method' for http_poller

method and headers are per-URL options, so the structure should be

http_poller {
	urls => {
		gff => {
            url => "http://bitbucket.serv.cdc.fr/rest/api/latest/projects/GFF/repos/?limit=1000"
			method => "GET"
			headers => {
				Accept => "application/json"
				Authorization => "Bearer ${BITBUCKET_TOKEN}"
			}
        }

etc. And yes, that requires repitition of the headers.

1 Like