# Source perl script in logstash input conf file

**URL:** <https://discuss.elastic.co/t/source-perl-script-in-logstash-input-conf-file/153955>\
**Category:** Logstash\
**Created:** [October 25, 2018, 9:14am UTC](https://discuss.elastic.co/t/source-perl-script-in-logstash-input-conf-file/153955 "2018-10-25T09:14:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![niraj\_pandey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_pandey/32/44034_2.png) [@niraj\_pandey](https://discuss.elastic.co/u/niraj_pandey)\
**Post date:** [October 25, 2018, 9:14am UTC](https://discuss.elastic.co/t/source-perl-script-in-logstash-input-conf-file/153955/1 "2018-10-25T09:14:12Z")

</div>

I have a perl script when I source it on my Linux shell (through the command eval `a.pl`) 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 a.pl;/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 (a.pl). When I run this complete command (eval `a.pl`;/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.

---

<div class="post-metadata">

**Author:** ![niraj\_pandey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_pandey/32/44034_2.png) [@niraj\_pandey](https://discuss.elastic.co/u/niraj_pandey)\
**Post date:** [October 29, 2018, 8:16am UTC](https://discuss.elastic.co/t/source-perl-script-in-logstash-input-conf-file/153955/2 "2018-10-29T08:16:36Z")

</div>

Can someone help me on this please ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 26, 2018, 8:28am UTC](https://discuss.elastic.co/t/source-perl-script-in-logstash-input-conf-file/153955/4 "2018-11-26T08:28:43Z")

</div>

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