Pass an array data as a variable to URL of http logstash plugin

Hi,

I am trying to pass an array to a URL as a loop could you please help me to acheive this in logstash pipeline.
Any suggestions that is provided is helpful
.
My response is below:
nodeId: 9
"datasource" => [
[ 0] "ciscoSupyState",
[ 1] "tcpAttemptFails",
[ 2] "tcpInSegs",
[ 3] "tcpRetransSegs"]

http plugin code:

http {
url => "http://XXXXXX/node[%{nodeId}].nodeSnmp[]/%{datasource}"
verb => "GET"
user => "xxxx"
password => "xxx"
target_body => "xxxx"
target_headers => "xxx"
headers => {
"Content-Type" => "application/json"
"Accept" => "application/json"
} }

See this thread.

Hi Badger,

Thank you for your reply.

But the elements in datasource are variable componet as they are not fixed. Please find the below response in detail.

{
"datasource" => [
[ 0] "ciscoMemoryPoolUsed",
[ 1] "ciscoSupyState",
[ 2] "csSupSource",
[ 3] "tcpEstabResets",
[ 4] "CiscoEnvMonState",
[ 5] "ciscoMemoryPoolFree"
[6],......
],
"DatasourceNodeId" => "2",
"@timestamp" => 2022-06-14T16:38:16.628472Z
}
{
"DatasourceNodeId" => "1"
"datasource" => [
[0] "icmp",
[1] "http",
[2] "https"
],

If neither approach in the linked thread works for you I would suggest making the http call from a ruby filter instead of using an http filter.

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