Hi, I am trying to pull API data from several endpoints all using the same Username and Password. Example:
input {
http_poller {
schedule => { every => "20s" }
request_timeout => 60
urls => {
"Path1" => {
method => get
user => "user@e.mail"
password => "password"
url => "https://server.com/api/v2/path/11167/data"
headers => {
Accept => "application/json"
}
}
"Path2" => {
method => get
user => "user@e.mail"
password => "password"
url => "https://server.com/api/v2/path/11168/data"
headers => {
Accept => "application/json"
}
}
"Path3" => {
method => get
user => "user@e.mail"
password => "password"
url => "https://server.com/api/v2/path/11169/data"
headers => {
Accept => "application/json"
}
}
}
# Decode the results as JSON
codec => "json"
# Store metadata about the request in this key
metadata_target => "http_poller_metadata"
}
}
output {
stdout {codec => rubydebug}
}
You can see the username/password combination is the same for all, and the URLs are almos tthe same except for the /{number}/data at the end.
So, I have 2 questions:
- can I put all of the paths into an array (ie [11167,11168,11169]) or
- can I put the user/password information somewhere else so I only need to store it once
(or 3) can I do both of these things?