<?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 pass arguments in custom search command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/504273#M140764</link>
    <description>&lt;P&gt;It would be nice to post updated and working links.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 13 Jun 2020 13:13:42 GMT</pubDate>
    <dc:creator>tomasmoser</dc:creator>
    <dc:date>2020-06-13T13:13:42Z</dc:date>
    <item>
      <title>how to pass arguments in custom search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/261880#M78628</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to write a script in which i can pass arguments from search bar.&lt;BR /&gt;
My basic script&lt;BR /&gt;
    $cat mytest.sh&lt;BR /&gt;
   print There are $# arguments to $0: $*&lt;BR /&gt;
   echo first argument: $1&lt;BR /&gt;
   echo second argument: $2&lt;BR /&gt;
   echo third argument: $3&lt;BR /&gt;
   echo here they are again: $@&lt;/P&gt;

&lt;P&gt;I have also made the required entries in commands.conf and my script is running from UI&lt;BR /&gt;
|mytest 1 2 3&lt;/P&gt;

&lt;P&gt;But its giving "External search command 'mytest' returned error code 1."&lt;/P&gt;

&lt;P&gt;In search.log I could find the error "SyntaxError: invalid syntax"&lt;BR /&gt;
But my script is running fine from backend, so the syntax is fine.&lt;/P&gt;

&lt;P&gt;I am not sure now, what the issue is.&lt;BR /&gt;
Kindly advise.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 23:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/261880#M78628</guid>
      <dc:creator>kamal_jagga</dc:creator>
      <dc:date>2016-03-24T23:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to pass arguments in custom search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/261881#M78629</link>
      <description>&lt;P&gt;I guess you're using wrong language for custom search command script. I should be written in Python and here are the links that can get you started.&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/Search/Aboutcustomsearchcommands"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/Search/Aboutcustomsearchcommands&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEU2"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEU2&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/AdvancedDev/Searchscripts"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.3/AdvancedDev/Searchscripts&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2016 14:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/261881#M78629</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-25T14:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to pass arguments in custom search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/261882#M78630</link>
      <description>&lt;P&gt;Actually I was using python only but got struck with it.So I thought of giving shell a try.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/385936/unable-to-execute-python-script-could-be-splunk-li.html"&gt;https://answers.splunk.com/answers/385936/unable-to-execute-python-script-could-be-splunk-li.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In my python script(want to pass 2 arguments from UI) I am able to run the script from backend but from UI. its not working. &lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2016 16:56:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/261882#M78630</guid>
      <dc:creator>kamal_jagga</dc:creator>
      <dc:date>2016-03-25T16:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to pass arguments in custom search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/504273#M140764</link>
      <description>&lt;P&gt;It would be nice to post updated and working links.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jun 2020 13:13:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-pass-arguments-in-custom-search-command/m-p/504273#M140764</guid>
      <dc:creator>tomasmoser</dc:creator>
      <dc:date>2020-06-13T13:13:42Z</dc:date>
    </item>
  </channel>
</rss>

