<?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: Using the Splunk Python SDK, how do I get my custom generating search command to use the result of a subsearch as parameter? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-the-Splunk-Python-SDK-how-do-I-get-my-custom-generating/m-p/181693#M52365</link>
    <description>&lt;P&gt;Just in case anyone comes across this, I ended up dropping the SDK and just using the Intersplunk module which allows you to parse the script parameters manually.&lt;/P&gt;

&lt;P&gt;For my purposes it was as simple as the code below, which does strip out some info like if the args have been linked by AND or OR, but this doesn't really affect what I was doing.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for arg in sys.argv:
        match = re.match(r'\s*(\S+?)\s*=\s*(\S+)', arg)

        if match:
                field = match.group(1)
                value = match.group(2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 04 Sep 2015 06:58:16 GMT</pubDate>
    <dc:creator>kierencrossland</dc:creator>
    <dc:date>2015-09-04T06:58:16Z</dc:date>
    <item>
      <title>Using the Splunk Python SDK, how do I get my custom generating search command to use the result of a subsearch as parameter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-Splunk-Python-SDK-how-do-I-get-my-custom-generating/m-p/181692#M52364</link>
      <description>&lt;P&gt;I am in the process of writing a custom command using the Python SDK.  It is a generating command.&lt;/P&gt;

&lt;P&gt;I would like the command to be able to process the result of a subsearch as a parameter, much like the search command does, ie:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"| gencmd [search some stuff | table field_of_interest]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It looks like the SearchCommandParser in the SDK is unable to parse the output for the subsearch.  So perhaps I'd be better off using InterSplunk?  Does anyone know if it is possible using that instead?  Or if there is a way to still use the SDK?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2015 06:55:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-Splunk-Python-SDK-how-do-I-get-my-custom-generating/m-p/181692#M52364</guid>
      <dc:creator>kierencrossland</dc:creator>
      <dc:date>2015-08-20T06:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Splunk Python SDK, how do I get my custom generating search command to use the result of a subsearch as parameter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-Splunk-Python-SDK-how-do-I-get-my-custom-generating/m-p/181693#M52365</link>
      <description>&lt;P&gt;Just in case anyone comes across this, I ended up dropping the SDK and just using the Intersplunk module which allows you to parse the script parameters manually.&lt;/P&gt;

&lt;P&gt;For my purposes it was as simple as the code below, which does strip out some info like if the args have been linked by AND or OR, but this doesn't really affect what I was doing.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for arg in sys.argv:
        match = re.match(r'\s*(\S+?)\s*=\s*(\S+)', arg)

        if match:
                field = match.group(1)
                value = match.group(2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Sep 2015 06:58:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-Splunk-Python-SDK-how-do-I-get-my-custom-generating/m-p/181693#M52365</guid>
      <dc:creator>kierencrossland</dc:creator>
      <dc:date>2015-09-04T06:58:16Z</dc:date>
    </item>
  </channel>
</rss>

