<?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: Custom search command Values for these required options are missing: ... in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Custom-search-command-Values-for-these-required-options-are/m-p/554349#M91870</link>
    <description>&lt;P&gt;I am not an expert on this, but it seems like the way you have it implemented, the code will check if the values for x and y are field names, when you likely want to validate that they are integers.&lt;/P&gt;&lt;P&gt;Can you try changing to this and see if that helps:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;x = Option(require=True, validate=validators.Integer())
y = Option(require=True, validate=validators.Integer())&lt;/LI-CODE&gt;&lt;P&gt;If it does, specifying my_script x="abc" y="def" should throw an error.&lt;/P&gt;&lt;P&gt;As you currently have it, validation would support my_script x=&lt;EM&gt;some_event_field&amp;nbsp; &lt;/EM&gt;y=&lt;EM&gt;some_other_event_field&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;At least that's my understanding on how it works. You can find a list of all implemented validators &lt;A href="https://github.com/splunk/splunk-sdk-python/blob/master/splunklib/searchcommands/validators.py" target="_self"&gt;here.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jun 2021 18:56:42 GMT</pubDate>
    <dc:creator>s2_splunk</dc:creator>
    <dc:date>2021-06-03T18:56:42Z</dc:date>
    <item>
      <title>Custom search command Values for these required options are missing: ...</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Custom-search-command-Values-for-these-required-options-are/m-p/554345#M91867</link>
      <description>&lt;P&gt;I need to pass to my python custom search command two values:&amp;nbsp;&lt;STRONG&gt;x&amp;nbsp;&lt;/STRONG&gt;and&amp;nbsp;&lt;STRONG&gt;y&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I found some examples where it's shown this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;x = Option(require=True, validate=validators.Fieldname())
y = Option(require=True, validate=validators.Fieldname())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I simply run my script by simply entering&amp;nbsp;&lt;STRONG&gt;my_script x=50, y=25&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Unfortunately I get this errors:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;U&gt;Illegal value: x=50&lt;/U&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;U&gt;Illegal value: y=25&lt;/U&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;U&gt;Values for these required options are missing: x, y&lt;/U&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot find neither the problem nor anyone who is facing this problem.&lt;/P&gt;&lt;P&gt;The code I copied from is an example taken from this url:&amp;nbsp;&lt;A href="https://holdmybeersecurity.com/2020/12/31/create-a-custom-splunk-search-commands-with-python3/" target="_blank" rel="noopener"&gt;Create a custom Splunk search commands with Python3 | HoldMyBeer (holdmybeersecurity.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 18:27:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Custom-search-command-Values-for-these-required-options-are/m-p/554345#M91867</guid>
      <dc:creator>Unige2021</dc:creator>
      <dc:date>2021-06-03T18:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Custom search command Values for these required options are missing: ...</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Custom-search-command-Values-for-these-required-options-are/m-p/554349#M91870</link>
      <description>&lt;P&gt;I am not an expert on this, but it seems like the way you have it implemented, the code will check if the values for x and y are field names, when you likely want to validate that they are integers.&lt;/P&gt;&lt;P&gt;Can you try changing to this and see if that helps:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;x = Option(require=True, validate=validators.Integer())
y = Option(require=True, validate=validators.Integer())&lt;/LI-CODE&gt;&lt;P&gt;If it does, specifying my_script x="abc" y="def" should throw an error.&lt;/P&gt;&lt;P&gt;As you currently have it, validation would support my_script x=&lt;EM&gt;some_event_field&amp;nbsp; &lt;/EM&gt;y=&lt;EM&gt;some_other_event_field&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;At least that's my understanding on how it works. You can find a list of all implemented validators &lt;A href="https://github.com/splunk/splunk-sdk-python/blob/master/splunklib/searchcommands/validators.py" target="_self"&gt;here.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 18:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Custom-search-command-Values-for-these-required-options-are/m-p/554349#M91870</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2021-06-03T18:56:42Z</dc:date>
    </item>
  </channel>
</rss>

