Source perl script in logstash input conf file

I have a perl script when I source it on my Linux shell (through the command eval it set few env variables. Now I need to source this file with logstash input file inside exec plugin. I tried the following but it doesn't work.

input {

exec {

command ='eval;/opt/awz --mshosts | sed -e s/host/hostname/g | sed -e s/type/ostype/g'

interval =86400

type => "xyz-mshost"

codec => json_lines

add_field => { "clustername" => "testcluster" }

In command variable I am passing "mshosts" as an argument to script "/opt/awz" and this mshosts variable is set through the perl script ( When I run this complete command (eval;/opt/awz --mshosts | sed -e s/host/hostname/g | sed -e s/type/ostype/g) on Linux shell it's working fine but not working through json input file.

If I use a shell script instead of perl to source the env variable for above command that one also works fine. Issue is when I pass perl script to source few env variable.

Can someone help me on this please ?

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