I have a field, assigned_to_current
, that occasionally contains an array of values. I want to pass each of these values to the HTTP filter and then have it replace each value with the http result value. I guess like the translate filter...but with an API call. Below is what I am doing with the field and it works great with single values. How can I adapt this to work with a field that may contain an array of values?
if [assigned_to_current] and [assigned_to_current] != "" and [assigned_to_current] != "guest" {
http {
headers => {
"Authorization" => "12345"
"Content-Type" => "application/json"
}
verb => "GET"
url => "https://example.com/api/sys_user/%{[assigned_to_current]}"
target_body => assigned_to_lookup
}
mutate { replace => { "assigned_to_current" => "%{[assigned_to_lookup][result][user_name]}" } }
}
else if ![assigned_to_current] or [assigned_to_current] == "" { mutate { replace => { "assigned_to_current" => "unassigned" } } }