Using response http_poller


(Antoine) #1

Hello,

I want to be able to add some information to Elastic from an API using http_poller.
I began with this :
input {
http_poller {
urls => {
"test" => {
method => get
url => "https://dashboard.meraki.com/api/v0/organizations/XXXXXX/networks"
headers => {
Accept => "application/json"
"x-cisco-meraki-api-key" => "ENTER API KEY"
}
}
}
request_timeout => 60
interval => 60
codec => "json"
}
}

Then I get a list of results with an network id for each.
{
"organizationId" => "XXXXXX",
"@timestamp" => 2017-10-12T07:34:20.053Z,
"name" => "AAAAAAAAAAAAA ",
"@version" => "1",
"timeZone" => "Europe/Paris",
"id" => "N_XXXXXXXXXXXX",
"type" => "appliance",
"tags" => " APPLIANCE "
}
I want to send another get method using all network ids previously received, something like
url => "https://dashboard.meraki.com/api/v0/organizations/XXXXXX/networks/N_XXXXXXXXX"
with a loop.

Is it possible to do this such of thing ?
If so, could you help me to do it please ?

Thanks a lot
Antoine


(Antoine) #2

I tried to save url in a variable and then call url with the variable and it is not working.

add_field => { "urlnetwork" => "https://dashboard.meraki.com/api/v0/organizations/XXXXXX/networks" }
add_field => { "urldevice" => "%{urlnetwork}/%{networkId}/devices"}

urls => {
"meraki_networkDevices" => {
method => get
url => "%{urldevice}"
}
}

Thanks a lot
Antoine


(system) #3

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