<?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: setup.xml: problems with windows scripted input format in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30940#M178065</link>
    <description>&lt;P&gt;I have the same exact problem and it's driving me nuts.&lt;/P&gt;

&lt;P&gt;One work around is to have a binary for each type of input (win/lin) something like script.win.py and script.lin.py.  But now you have the same code in two python files possibly.&lt;/P&gt;

&lt;P&gt;Another work around is to use entity=".*script.win.py" mode="bulk".  But now it will enable/disable both the windows and linux inputs each time.  Side note, having a linux type scripted input enabled doesnt cause any harm.&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jul 2016 02:43:59 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2016-07-09T02:43:59Z</dc:date>
    <item>
      <title>setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30932#M178057</link>
      <description>&lt;P&gt;I have a setup.xml which uses the following format for scripted inputs on Unix systems:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# inputs.conf
[script://./bin/nmap.sh]

# setup.xml
&amp;lt;block title="Ping Scan" endpoint="admin/script" entity=".%252Fbin%252Fnmap.sh"&amp;gt;
  ...
&amp;lt;/block&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That works just fine, though I'll admit that I'm not clear on what the "25" part of %252F represents (I realize %2F is a "/" character, and I think %25 is a "%" character?).  Anyways, I'm having some problems flipping this around for Windows.  What should the "encoded" script path look like?  The following doesn't work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# inputs.conf
[script://.\bin\nmap.cmd]

# setup.xml
&amp;lt;block title="Ping Scan" endpoint="admin/script" entity=".%5Cbin%5Cnmap.cmd"&amp;gt;
  ...
&amp;lt;/block&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The input stanza works just fine for me.  The setup.xml block displays correctly on the setup page as is, but if I try to save it I get an error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Encountered the following error while trying to update: In handler 'localapps': Cannot edit input &amp;amp;quot;.binnmap.cmd&amp;amp;quot;, no input exists with that name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The error shows no backslash characters, so I'm wondering if they're getting chewed up on the save operation, or just in displaying the error.  In any case, I've tried a few variations on the block, but if I move away from just the "%5C" the setup page won't display at all saying that it can't be found or something similar:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;block title="Ping Scan" endpoint="admin/script" entity=".%255Cbin%255Cnmap.cmd"&amp;gt;
&amp;lt;block title="Ping Scan" endpoint="admin/script" entity=".%5C5Cbin%5C5Cnmap.cmd"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What am I doing wrong here?&lt;/P&gt;

&lt;P&gt;Also, as a side note, while it's not such a big deal in this case, it would be awesome if I could use a forward slash in inputs.conf on both Unix and Windows.  i.e. why can't the stanza below just work everywhere?&lt;/P&gt;

&lt;P&gt;[script://.bin/foo.py]&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2011 12:34:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30932#M178057</guid>
      <dc:creator>mw</dc:creator>
      <dc:date>2011-06-20T12:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30933#M178058</link>
      <description>&lt;P&gt;The easiest way to get the entity for such setup.xml fields is to look at the REST endpoint listing. Just point your browser to &lt;A href="https://your-splunk-server:8089/services/data/inputs/script"&gt;https://your-splunk-server:8089/services/data/inputs/script&lt;/A&gt; and simply copy the url and take the entity part from it.&lt;/P&gt;

&lt;P&gt;Btw. I second the suggestion of being able to specify scripts using forward slashes on Windows.&lt;/P&gt;

&lt;P&gt;Update:&lt;/P&gt;

&lt;P&gt;In my experience it's better to add scripted inputs by specifying the full path:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://$SPLUNK_HOME/etc/apps/myapp/bin/myscript.py]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To illustrate what I was trying to say above:&lt;/P&gt;

&lt;P&gt;You can find multiple links (those are links to entities) at the REST page I've mentioned above. For example the link could look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="https://localhost:8089/servicesNS/nobody/myapp/admin/script/%24SPLUNK_HOME%5Cetc%5Capps%5Cmyapp%5Cbin%5Cmyscript.py" target="test_blank"&gt;https://localhost:8089/servicesNS/nobody/myapp/admin/script/%24SPLUNK_HOME%5Cetc%5Capps%5Cmyapp%5Cbin%5Cmyscript.py&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The entity you have to use in the setup.xml is the part after the last &lt;CODE&gt;/&lt;/CODE&gt;. ie:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;%24SPLUNK_HOME%5Cetc%5Capps%5Cmyapp%5Cbin%5Cmyscript.py
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jun 2011 19:02:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30933#M178058</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-06-20T19:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30934#M178059</link>
      <description>&lt;P&gt;Thanks for the help.  I actually don't see many of my scripted inputs at that url.  In fact, the only place that I could find a reference is here: &lt;A href="https://your-splunk-server:8089/services/apps/local/asset_discovery/setup"&gt;https://your-splunk-server:8089/services/apps/local/asset_discovery/setup&lt;/A&gt;.  However, I'm not sure how reliable that is for Splunk's idea of what the encoded path should be versus what my setup routine has specified...&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2011 01:51:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30934#M178059</guid>
      <dc:creator>mw</dc:creator>
      <dc:date>2011-06-21T01:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30935#M178060</link>
      <description>&lt;P&gt;I believe the following will work for both unix and windows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;block title="Ping Scan" endpoint="admin/script" entity=".*bin.*nmap\..*" mode="iter"&amp;gt;
...
&amp;lt;/block&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Update:  It looks like &lt;CODE&gt;admin/script&lt;/CODE&gt; is interpreting your relative path.  For example, on my machine &lt;CODE&gt;./bin/nmap.sh&lt;/CODE&gt; translates to &lt;CODE&gt;/Users/hazekamp/Applications/splunk/etc/system/local/bin/nmap.sh&lt;/CODE&gt; in &lt;CODE&gt;admin/script&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;The wildcarded entity above should be generic enough to match your nmap command.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2011 03:33:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30935#M178060</guid>
      <dc:creator>hazekamp</dc:creator>
      <dc:date>2011-06-21T03:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30936#M178061</link>
      <description>&lt;P&gt;You're using the admin/script endpoint and not any custom setup routine. You should at least see a reference here &lt;A href="https://localhost:8089/services/admin/script"&gt;https://localhost:8089/services/admin/script&lt;/A&gt; if your input is configured correctly.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2011 07:41:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30936#M178061</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-06-21T07:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30937#M178062</link>
      <description>&lt;P&gt;That seems to work ok enough to allow the setup page to render, but I still get the same error when I attempt to save (on my [script://.\bin\nmap.cmd] input).  I'm at a loss.  I don't know if I'm being an idiot, or this is some weird bug...&lt;/P&gt;

&lt;P&gt;My comment on format for both Unix and Windows was really directed at inputs.conf (i.e. if I have a python input, why do I need to muck around with forward vs. backslash if I've taken the time to code my python to work on any platform) -- it was a bit of a tangent. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2011 16:47:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30937#M178062</guid>
      <dc:creator>mw</dc:creator>
      <dc:date>2011-06-21T16:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30938#M178063</link>
      <description>&lt;P&gt;Yeah, I'm confused by that.  I don't see much at the other url either.  Everything I see at those urls starts with $SPLUNK_HOME and the data is in the default index...&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2011 17:01:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30938#M178063</guid>
      <dc:creator>mw</dc:creator>
      <dc:date>2011-06-21T17:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30939#M178064</link>
      <description>&lt;P&gt;I've updated the answer. I hope that's understandable now.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2011 19:14:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30939#M178064</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-06-21T19:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30940#M178065</link>
      <description>&lt;P&gt;I have the same exact problem and it's driving me nuts.&lt;/P&gt;

&lt;P&gt;One work around is to have a binary for each type of input (win/lin) something like script.win.py and script.lin.py.  But now you have the same code in two python files possibly.&lt;/P&gt;

&lt;P&gt;Another work around is to use entity=".*script.win.py" mode="bulk".  But now it will enable/disable both the windows and linux inputs each time.  Side note, having a linux type scripted input enabled doesnt cause any harm.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2016 02:43:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30940#M178065</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-07-09T02:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: setup.xml: problems with windows scripted input format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30941#M178066</link>
      <description>&lt;P&gt;did you find any solution?I am facing similar issue&lt;BR /&gt;
I am trying to update input.conf stanza at windows, it is working fine in linux but giving following error in windows 7.&lt;/P&gt;

&lt;P&gt;Encountered the following error while trying to update: In handler 'localapps': Cannot find item for POST arg_name="/admin/script/%24SPLUNK_HOME%5Cetc%5Capps%5Cmy_app%5Cbin%5Cmy_script.py%2015/enabled"&lt;/P&gt;

&lt;P&gt;For reference, here are excerpts from inputs.conf and setup.xml:&lt;/P&gt;

&lt;P&gt;inputs.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [script://$SPLUNK_HOME\etc\apps\my_app\bin\my_script.py 15]
      disabled = 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;setup.xml&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;block title="my script setting"
             endpoint="admin/script"
             entity="%24SPLUNK_HOME%5Cetc%5Capps%5CiSIGHTPartners_ThreatScape_App%5Cbin%5Cmy_script.py%2015"&amp;gt;
     &amp;lt;input field="enabled"&amp;gt;
         &amp;lt;label&amp;gt;Enable&amp;lt;/label&amp;gt;
         &amp;lt;type&amp;gt;bool&amp;lt;/type&amp;gt;
     &amp;lt;/input&amp;gt;
 &amp;lt;/block&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help will be appreciated.&lt;BR /&gt;
thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setup-xml-problems-with-windows-scripted-input-format/m-p/30941#M178066</guid>
      <dc:creator>splunk_mkhan</dc:creator>
      <dc:date>2020-09-29T13:12:10Z</dc:date>
    </item>
  </channel>
</rss>

