<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Environment variable in scripted input relative to App directory in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312284#M58540</link>
    <description>&lt;P&gt;Splunk does not actually make environment variables available inside .conf files, but  you CAN use " &lt;CODE&gt;.&lt;/CODE&gt; " to represent the app path like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://.\bin\evaluator.exe]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 19 Sep 2018 16:41:04 GMT</pubDate>
    <dc:creator>BonMot</dc:creator>
    <dc:date>2018-09-19T16:41:04Z</dc:date>
    <item>
      <title>Environment variable in scripted input relative to App directory</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312281#M58537</link>
      <description>&lt;P&gt;I provide an App that uses an executable on Windows systems to generate some data. This program is located in the &lt;CODE&gt;bin&lt;/CODE&gt; directory of my App named "TA-myapp". In the &lt;CODE&gt;inputs.conf&lt;/CODE&gt; I set a scripted input that executes the program and indexes the output. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://$SPLUNK_HOME/etc/apps/TA-myapp/bin/evaluator.exe]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My problem is that our customer wants to deploy different versions of our app with different settings. So he renames &lt;CODE&gt;myapp&lt;/CODE&gt; to &lt;CODE&gt;myapp1&lt;/CODE&gt; and &lt;CODE&gt;myapp2&lt;/CODE&gt; ... and so on.&lt;/P&gt;

&lt;P&gt;Is there a environment variable that references the App home directory so that I could use that variable to configure an input like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://$APP_HOME/bin/evaluator.exe]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am using $APP_HOME in that example because I've found references in different splunk developer documentation pages but it doesn't work. The splunkd.log states:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ERROR FrameworkUtils - Incorrect path to script: \$APP_HOME\bin\evaluator.exe.  Script must be located inside $SPLUNK_HOME\bin\scripts.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 11:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312281#M58537</guid>
      <dc:creator>FRoth</dc:creator>
      <dc:date>2017-11-27T11:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable in scripted input relative to App directory</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312282#M58538</link>
      <description>&lt;P&gt;No there isn't anything like $APP_HOME. &lt;/P&gt;

&lt;P&gt;Have you considered using  modular input instead of scripted input as it provides more control with multiple configurations.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 11:39:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312282#M58538</guid>
      <dc:creator>hardikJsheth</dc:creator>
      <dc:date>2017-11-27T11:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable in scripted input relative to App directory</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312283#M58539</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You can try below : &lt;/P&gt;

&lt;P&gt;you can run below command :&lt;/P&gt;

&lt;P&gt;C:\Program Files\Splunk\bin&amp;gt;splunk envvars &amp;gt; setSplunkEnv.bat&lt;/P&gt;

&lt;P&gt;it will create file setSplunkEnv.bat under C:\Program Files\Splunk\bin with below content:&lt;/P&gt;

&lt;P&gt;SET Path=C:\Program Files\Splunk\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Users\balaji\AppData\Local\Microsoft\WindowsApps&lt;BR /&gt;
SET HOSTNAME=balu-pc&lt;BR /&gt;
SET SPLUNK_HOME=C:\Program Files\Splunk&lt;BR /&gt;
SET SPLUNK_DB=C:\Program Files\Splunk\var\lib\splunk&lt;BR /&gt;
SET SPLUNK_ETC=C:\Program Files\Splunk\etc&lt;BR /&gt;
SET RANDFILE=C:\Program Files\Splunk\var\run.rnd&lt;BR /&gt;
SET SPLUNK_SERVER_NAME=Splunkd&lt;BR /&gt;
SET SPLUNK_WEB_NAME=splunkweb&lt;BR /&gt;
SET PYTHONPATH=C:\Program Files\Splunk\bin;C:\Program Files\Splunk\Python-2.7\Lib\site-packages\win32;C:\Program Files\Splunk\Python-2.7\Lib\site-packages;C:\Program Files\Splunk\Python-2.7\Lib&lt;BR /&gt;
SET PYTHONHASHSEED=random&lt;BR /&gt;
SET NODE_PATH=C:\Program Files\Splunk\lib\node_modules&lt;BR /&gt;
SET OPENSSL_CONF=C:\Program Files\Splunk\openssl.cnf&lt;BR /&gt;
SET LDAPCONF=C:\Program Files\Splunk\etc\openldap\ldap.conf&lt;/P&gt;

&lt;P&gt;you can add new line to the content of file like below:&lt;/P&gt;

&lt;P&gt;SET APP_HOME=C:\Program Files\Splunk\etc\apps\myapp&lt;/P&gt;

&lt;P&gt;you need to change myapp to new name when ever you deployed new app to apps.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:57:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312283#M58539</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-29T16:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable in scripted input relative to App directory</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312284#M58540</link>
      <description>&lt;P&gt;Splunk does not actually make environment variables available inside .conf files, but  you CAN use " &lt;CODE&gt;.&lt;/CODE&gt; " to represent the app path like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://.\bin\evaluator.exe]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Sep 2018 16:41:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Environment-variable-in-scripted-input-relative-to-App-directory/m-p/312284#M58540</guid>
      <dc:creator>BonMot</dc:creator>
      <dc:date>2018-09-19T16:41:04Z</dc:date>
    </item>
  </channel>
</rss>

