<?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: How do I run a shell script in a universal forwarder? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-run-a-shell-script-in-a-universal-forwarder/m-p/390850#M69899</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/90549"&gt;@raj_mpl&lt;/a&gt; ,&lt;/P&gt;

&lt;P&gt;If you are referring to the scripted inputs , then most likely it should be part of an app. To find the location of the script, use &lt;CODE&gt;btool&lt;/CODE&gt; and list all the inputs &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SPLUNK_HOME/bin/splunk btool inputs list --debug|grep "your script name"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once you find the script, you may execute them on your forwarder to verify the result by either using the absolute path or relative path.&lt;/P&gt;

&lt;P&gt;For e.g. if your script is located in SPLUNK_HOME/etc/apps/my_app/bin/myscript.sh , you may run it using the entire path or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cd SPLUNK_HOME/etc/apps/my_app/bin/
./myscript.sh
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;EM&gt;where SPLUNK_HOME is your splunk installation directory&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Reference&lt;/STRONG&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Scripted Input:

[script://&amp;lt;cmd&amp;gt;]
* Runs &amp;lt;cmd&amp;gt; at a configured interval (see below) and indexes the output
  that &amp;lt;cmd&amp;gt; returns.
* The &amp;lt;cmd&amp;gt; must reside in one of the following directories:
  * $SPLUNK_HOME/etc/system/bin/
  * $SPLUNK_HOME/etc/apps/$YOUR_APP/bin/
  * $SPLUNK_HOME/bin/scripts/
* The path to &amp;lt;cmd&amp;gt; can be an absolute path, make use of an environment
  variable such as $SPLUNK_HOME, or use the special pattern of an initial '.'
  as the first directory to indicate a location inside the current app.
* The '.' specification must be followed by a platform-specific directory
  separator.
  * For example, on UNIX:
        [script://./bin/my_script.sh]
    Or on Windows:
        [script://.\bin\my_program.exe]
    This '.' pattern is strongly recommended for app developers, and necessary
    for operation in search head pooling environments.
* &amp;lt;cmd&amp;gt; can also be a path to a file that ends with a ".path" suffix. A file
  with this suffix is a special type of pointer file that points to a command
  to be run. Although the pointer file is bound by the same location
  restrictions mentioned above, the command referenced inside it can reside
  anywhere on the file system. The .path file must contain exactly one line:
  the path to the command to run, optionally followed by command-line
  arguments. The file can contain additional empty lines and lines that begin
  with '#'. The input ignores these lines.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 22:38:09 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2020-09-29T22:38:09Z</dc:date>
    <item>
      <title>How do I run a shell script in a universal forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-run-a-shell-script-in-a-universal-forwarder/m-p/390849#M69898</link>
      <description>&lt;P&gt;I have a problem here. My shell script is not giving the complete output in the Splunk search head . What is the command to check and run the script in the UF?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jan 2019 09:08:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-run-a-shell-script-in-a-universal-forwarder/m-p/390849#M69898</guid>
      <dc:creator>raj_mpl</dc:creator>
      <dc:date>2019-01-01T09:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I run a shell script in a universal forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-run-a-shell-script-in-a-universal-forwarder/m-p/390850#M69899</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/90549"&gt;@raj_mpl&lt;/a&gt; ,&lt;/P&gt;

&lt;P&gt;If you are referring to the scripted inputs , then most likely it should be part of an app. To find the location of the script, use &lt;CODE&gt;btool&lt;/CODE&gt; and list all the inputs &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SPLUNK_HOME/bin/splunk btool inputs list --debug|grep "your script name"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once you find the script, you may execute them on your forwarder to verify the result by either using the absolute path or relative path.&lt;/P&gt;

&lt;P&gt;For e.g. if your script is located in SPLUNK_HOME/etc/apps/my_app/bin/myscript.sh , you may run it using the entire path or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cd SPLUNK_HOME/etc/apps/my_app/bin/
./myscript.sh
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;EM&gt;where SPLUNK_HOME is your splunk installation directory&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Reference&lt;/STRONG&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Scripted Input:

[script://&amp;lt;cmd&amp;gt;]
* Runs &amp;lt;cmd&amp;gt; at a configured interval (see below) and indexes the output
  that &amp;lt;cmd&amp;gt; returns.
* The &amp;lt;cmd&amp;gt; must reside in one of the following directories:
  * $SPLUNK_HOME/etc/system/bin/
  * $SPLUNK_HOME/etc/apps/$YOUR_APP/bin/
  * $SPLUNK_HOME/bin/scripts/
* The path to &amp;lt;cmd&amp;gt; can be an absolute path, make use of an environment
  variable such as $SPLUNK_HOME, or use the special pattern of an initial '.'
  as the first directory to indicate a location inside the current app.
* The '.' specification must be followed by a platform-specific directory
  separator.
  * For example, on UNIX:
        [script://./bin/my_script.sh]
    Or on Windows:
        [script://.\bin\my_program.exe]
    This '.' pattern is strongly recommended for app developers, and necessary
    for operation in search head pooling environments.
* &amp;lt;cmd&amp;gt; can also be a path to a file that ends with a ".path" suffix. A file
  with this suffix is a special type of pointer file that points to a command
  to be run. Although the pointer file is bound by the same location
  restrictions mentioned above, the command referenced inside it can reside
  anywhere on the file system. The .path file must contain exactly one line:
  the path to the command to run, optionally followed by command-line
  arguments. The file can contain additional empty lines and lines that begin
  with '#'. The input ignores these lines.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:38:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-run-a-shell-script-in-a-universal-forwarder/m-p/390850#M69899</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-09-29T22:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I run a shell script in a universal forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-run-a-shell-script-in-a-universal-forwarder/m-p/390851#M69900</link>
      <description>&lt;P&gt;Thank you @renjith.nair&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 11:24:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-run-a-shell-script-in-a-universal-forwarder/m-p/390851#M69900</guid>
      <dc:creator>raj_mpl</dc:creator>
      <dc:date>2019-01-02T11:24:47Z</dc:date>
    </item>
  </channel>
</rss>

