How will create a global variable in logstash?

Hello,

My config is like this -

input{
http_poller{
// here I have mentioned API url and authorisation
tags => ["tag1"]
}
http_poller{
// here I have mentioned API url and authorisation
tags => ["tag2"]
}
http_poller{
// here I have mentioned API url and authorisation
tags => ["tag3"]
}
}
filter { 
  mutate {
	remove_field => [ "[message]" ]
	remove_field => [ "[@version]" ]
	remove_field => [ "[@timestamp]" ]
	remove_field => [ "[event]" ]
  }
}
output{
if "tag1" in tags
{
elasticsearch{
//elastic credentials and index name
}
}
if "tag2" in tags
{
elasticsearch{
//elastic credentials and index name
}
}
if "tag3" in tags
{
elasticsearch{
//elastic credentials and index name
}
}
}

Here Api Credentials and Elastic credentials are same for all the tags. So, I want to use a global variable so that I can use it in the configuration.

P.s: I dont want to use environment variable. Is there any other way to do that???

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