<?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 to allow shell wildcard in scripted input's argument? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339298#M62625</link>
    <description>&lt;P&gt;Ah and I forget to answer the initial question: wildcards are not allowed in the path, the path must be be an absolute path.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2017 02:31:40 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2017-06-16T02:31:40Z</dc:date>
    <item>
      <title>How to allow shell wildcard in scripted input's argument?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339296#M62623</link>
      <description>&lt;P&gt;For example, if I put this in inputs.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script:/bin/ls /*/lib /var/lib /usr/lib ]
sourcetype = ls
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The latter two will produce desired output, but the first one generates errors like&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;ERROR ExecProcessor - message from /bin/ls "/\&lt;EM&gt;/lib" ls : cannot access `/&lt;/EM&gt;/lib': No such file or directory&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Basically splunkd refuses to honor the basic shell wildcard; it even internally puts a backslash to protect the argument, apparently together with adding double quotes which in tells a shell to interpret special characters.  This is very strange because in "script", I expect the behavior to be the same as if I am running in a script.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 18:15:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339296#M62623</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2017-04-19T18:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to allow shell wildcard in scripted input's argument?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339297#M62624</link>
      <description>&lt;P&gt;Hi yuanliu,&lt;/P&gt;

&lt;P&gt;Maybe I get something wrong here, but this is not the way you should use this kind of input. I see multiple problems here:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;The input is missing &lt;CODE&gt;//&lt;/CODE&gt; so it should be &lt;CODE&gt;[script:///bin/ls]&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;The &lt;CODE&gt;/bin&lt;/CODE&gt; directory is outside of the default allowed script paths &lt;CODE&gt;$SPLUNK_HOME/etc/system/bin/&lt;/CODE&gt;, &lt;CODE&gt;$SPLUNK_HOME/etc/apps/$YOUR_APP/bin/&lt;/CODE&gt; or &lt;CODE&gt;$SPLUNK_HOME/bin/scripts/&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;You're listing multiple possible scripts in one single monitor, even though &lt;CODE&gt;/var/lib&lt;/CODE&gt; and &lt;CODE&gt;/usr/lib&lt;/CODE&gt; are not really scripts&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;So, for example to get &lt;CODE&gt;/bin/ls&lt;/CODE&gt; working in a custom app, you need an inputs stanza like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://./bin/myScript.path]
sourcetype = ls
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in &lt;CODE&gt;$SPLUNK_HOME/etc/apps/$YOUR_APP/bin/&lt;/CODE&gt; a file called &lt;CODE&gt;myScript.path&lt;/CODE&gt;. This file then contains this entry:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/bin/ls
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Only call one executable per &lt;CODE&gt;script://&lt;/CODE&gt; stanza and test one by one.&lt;/P&gt;

&lt;P&gt;Hope this helps to get you started ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 02:30:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339297#M62624</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-06-16T02:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to allow shell wildcard in scripted input's argument?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339298#M62625</link>
      <description>&lt;P&gt;Ah and I forget to answer the initial question: wildcards are not allowed in the path, the path must be be an absolute path.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 02:31:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339298#M62625</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-06-16T02:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to allow shell wildcard in scripted input's argument?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339299#M62626</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;The input is missing // so it should be [script:///bin/ls]&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;The example is composed, not the real one.  The real script is relative in the same app path.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;You're listing multiple possible scripts in one single monitor, even though /var/lib and /usr/lib are not really scripts&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;What follow the script name are arguments to the very script just like in a shell, not scripts.  Again, the example is composed; I'm not really interested in /var/lib and /usr/lib.&lt;/P&gt;

&lt;P&gt;Is it documented anywhere that wildcard would not be allowed in script arguments?  What is the reason for this?  I would argue that it is a bug not to expand shell wildcards when the syntax is fully shell compliant.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 04:00:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339299#M62626</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2017-06-16T04:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to allow shell wildcard in scripted input's argument?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339300#M62627</link>
      <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf&lt;/A&gt; &lt;BR /&gt;
search for the script:// stanza, it says&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;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.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It does not mention wildcards in these two options.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 04:04:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339300#M62627</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-06-16T04:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to allow shell wildcard in scripted input's argument?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339301#M62628</link>
      <description>&lt;P&gt;And if you want to provided arguments to a command, use the &lt;CODE&gt;filename.path&lt;/CODE&gt; example which then called the final command with your command arguments.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 04:17:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339301#M62628</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-06-16T04:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to allow shell wildcard in scripted input's argument?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339302#M62629</link>
      <description>&lt;P&gt;Not mentioning and forbidding are two different propositions.  Splunk's [monitor] stanza accepts wildcards in path name, what is a reason why [script] must not?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 17:49:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339302#M62629</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2017-06-16T17:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to allow shell wildcard in scripted input's argument?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339303#M62630</link>
      <description>&lt;P&gt;The script stanza has been limited for security reasons to the default directories &lt;CODE&gt;$SPLUNK_HOME/etc/system/bin/&lt;/CODE&gt;, &lt;CODE&gt;$SPLUNK_HOME/etc/apps/$YOUR_APP/bin/&lt;/CODE&gt; and &lt;CODE&gt;$SPLUNK_HOME/bin/scripts/&lt;/CODE&gt;. This was done years ago to prevent a scripted input to run executables outside of Splunk. &lt;BR /&gt;
If you still want to run executables outside of Splunk you can use the &lt;CODE&gt;filename.path&lt;/CODE&gt; file approach, but I can tell you right now that in this file wildcards are also not support &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;If you want to get an answer why it is not mentioned in the docs, just submit a feedback on the docs page of &lt;CODE&gt;inputs.conf&lt;/CODE&gt; with you question and the docs team will take care of it.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 21:16:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-allow-shell-wildcard-in-scripted-input-s-argument/m-p/339303#M62630</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-06-16T21:16:23Z</dc:date>
    </item>
  </channel>
</rss>

