<?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: Can a custom search command launch a splunk search? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14767#M77</link>
    <description>&lt;P&gt;This is tracked by SPL-31148.&lt;/P&gt;</description>
    <pubDate>Sun, 06 Jun 2010 09:31:54 GMT</pubDate>
    <dc:creator>Stephen_Sorkin</dc:creator>
    <dc:date>2010-06-06T09:31:54Z</dc:date>
    <item>
      <title>Can a custom search command launch a splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14761#M71</link>
      <description>&lt;P&gt;Is it possible for a custom search script to launch another splunk search?&lt;/P&gt;

&lt;P&gt;I've been looking over the docs and sources for the &lt;CODE&gt;splunk.Intersplunk&lt;/CODE&gt; module and I'm getting conflicting info.  For example, &lt;CODE&gt;getOrganizedResults()&lt;/CODE&gt; claims that settings will always be an empty dict, but I do get settings back.  It also explicitly notes that the &lt;CODE&gt;auth token&lt;/CODE&gt; is not handled, but the settings value of &lt;CODE&gt;"sessionKey"&lt;/CODE&gt; is available.  (Even when &lt;CODE&gt;passauth&lt;/CODE&gt; is set to false, interestingly enough.)  Then again, I see in &lt;CODE&gt;crawl.py&lt;/CODE&gt; an example where the &lt;CODE&gt;sessionKey&lt;/CODE&gt; is being used to make calls back to splunkd using the python SDK, so it seems like this must be working at some level.&lt;/P&gt;

&lt;P&gt;However, if I attempt to acutually launch a search using the &lt;CODE&gt;sessionKey&lt;/CODE&gt;, &lt;CODE&gt;owner&lt;/CODE&gt;, and &lt;CODE&gt;namespace&lt;/CODE&gt; that is passed in via the &lt;CODE&gt;settings&lt;/CODE&gt; dictionary to a new search, then it tells me that I get the following error:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;&lt;CODE&gt;splunk.AuthenticationFailed: [HTTP 401] Client is not authenticated; None&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I've done some logging in my search command to confirm that the search command is working and that I'm getting a different &lt;CODE&gt;sessionKey&lt;/CODE&gt; each time, but the given &lt;CODE&gt;sessionKey&lt;/CODE&gt; seems to be unusable to launch another search.&lt;/P&gt;

&lt;P&gt;If I hard code a call to &lt;CODE&gt;splunk.auth.getSessionKey&lt;/CODE&gt; (logging on with the same user) then I can make the search work, but that's not really a solution.&lt;/P&gt;

&lt;P&gt;Is this a bug, a feature?  Any ideas?&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Things I've tried:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Using a normal (event fetching) search which is fed into my custom search script.  If I try to run a saved search, a norm data fetching search, or a non-data command (like "metadata types=hosts") I keep getting the same AuthenticationFailed error shown above.&lt;/LI&gt;
&lt;LI&gt;Using a event-generating admin command ("| metadata type=hosts") to feed into my custom search command does allow me to launch a search or saved search successfully.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 03 Jun 2010 04:45:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14761#M71</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-06-03T04:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can a custom search command launch a splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14762#M72</link>
      <description>&lt;P&gt;This appears to be a bug when running a search as a separate process. It appears that we create a session key for that process but not the main splunkd process. Could you try your custom search command with a search like "| metadata hosts | mysearchcommand" and see if it works?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2010 21:35:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14762#M72</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2010-06-03T21:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can a custom search command launch a splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14763#M73</link>
      <description>&lt;P&gt;Stephen, you are correct.  I can successfully launch a search from my custom search script if the first search command is &lt;CODE&gt;metadata&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2010 22:25:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14763#M73</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-06-03T22:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can a custom search command launch a splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14764#M74</link>
      <description>&lt;P&gt;I tried running my search command from a saved search that was set with &lt;CODE&gt;dispatch.spawn_process = false&lt;/CODE&gt;, but I still get the auth errors.  Any ideas on a workaround?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2010 03:59:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14764#M74</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-06-04T03:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can a custom search command launch a splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14765#M75</link>
      <description>&lt;P&gt;Unfortunately there's no good workaround until we fix this. It is scheduled to arrive in 4.1.4.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2010 23:51:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14765#M75</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2010-06-04T23:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can a custom search command launch a splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14766#M76</link>
      <description>&lt;P&gt;Thanks Stephen.  Guess I'll have to hard-code the login info in the script (or in a password file) for the time being...  I'll be looking forward to 4.1.4.  BTW, is there a SPL number for this issue?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2010 00:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14766#M76</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-06-05T00:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can a custom search command launch a splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14767#M77</link>
      <description>&lt;P&gt;This is tracked by SPL-31148.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jun 2010 09:31:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14767#M77</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2010-06-06T09:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can a custom search command launch a splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14768#M78</link>
      <description>&lt;P&gt;I can confirm that the 4.1.4 release fixed this issue for me.  It is now possible to execute a saved search from a search command!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2010 03:23:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-a-custom-search-command-launch-a-splunk-search/m-p/14768#M78</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-08-03T03:23:22Z</dc:date>
    </item>
  </channel>
</rss>

