<?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 Fails to Return Results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329058#M97939</link>
    <description>&lt;P&gt;Did you restart splunk?&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 17:52:12 GMT</pubDate>
    <dc:creator>svasani_splunk</dc:creator>
    <dc:date>2017-10-31T17:52:12Z</dc:date>
    <item>
      <title>Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329045#M97926</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I created a custom search command that queries an external service and returns a set of results using the v2 API (GeneratingCommand).  This works perfectly on a standalone box, but when I put it onto a cluster, it appears to run but not display any results.  Is there anything I could be missing that would cause this to occur?&lt;/P&gt;

&lt;P&gt;Some details:&lt;/P&gt;

&lt;P&gt;The cluster consists of a single standalone search node that is connected to 6 indexers.  They are all part of the same cluster.  This search node, however, is separate from the others for development purposes.&lt;/P&gt;

&lt;P&gt;I can see that the search command runs on all of the index nodes and I can see that it is distributed to them.  I have logging enabled, so I can see that it is getting results, but I just don't see the results showing up.&lt;/P&gt;

&lt;P&gt;My command.conf looks similar to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[command]
filename = command.py
chunked = true
passauth = true
requires_srinfo = true
enableheader = true
stderr_dest = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;Edit 1: I decided to poke around a bit more and I can see that in the metrics.log file, I can see the command I'm trying to execute with the suffix "-too_small".  Does this mean that the command simply isn't generating enough data?  It's never going to get much, but it is necessary.  Is there an option I can set to override this?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 16:56:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329045#M97926</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-10-27T16:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329046#M97927</link>
      <description>&lt;P&gt;Have you verified that it is not running out of time or memory on the search head?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 22:46:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329046#M97927</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-10-27T22:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329047#M97928</link>
      <description>&lt;P&gt;HI&lt;/P&gt;

&lt;P&gt;1) Can you please add below property and try again?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[command]
type = python
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) Have you checked the error log in splunkd.log and python.log??&lt;BR /&gt;
3) Is that any error in search job ??&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2017 10:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329047#M97928</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-29T10:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329048#M97929</link>
      <description>&lt;P&gt;I haven't seen any indication that it is running out of memory.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 12:14:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329048#M97929</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-10-30T12:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329049#M97930</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;No change using that property.&lt;/LI&gt;
&lt;LI&gt;No errors in splunkd.log or python.log&lt;/LI&gt;
&lt;LI&gt;If I look at the logs for the search job, the only "errors" I see are messages to STDERR that show the records I'm expecting to see in the search results, but that's it.  I don't know why this occurs as I have it logging to a log file via the Python logging library.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Now, this brings me to something strange that I'm seeing.  I log the fact that the the command is running 5 times, but I only see results coming back 4 times.  Could the fact I'm not getting results back from every run be causing this?  Why is this being executed multiple times?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 12:37:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329049#M97930</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-10-30T12:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329050#M97931</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
yeah, strange.  Conf file looks ok. Can you please provide sample code of your python file? &lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 16:21:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329050#M97931</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-30T16:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329051#M97932</link>
      <description>&lt;P&gt;Sure.  Here's basically what the code looks like minus imports and some logging config:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;logger = logging.getLogger()

@Configuration
class GetRemoteData(GeneratingCommand):
    _defaultConfig = "/path/to/config.ini"
    _config = ConfigParser.RawConfigParser()
    _config.read(_defaultConfig)

    def generate(self):
        logger.info("Running GetRemoteData")
        try:
            md = self._metadata.searchinfo
            service = RemoteService(params)
            results = service.getData(str(md.username))
            if results == []:
                raise ValueError("No results could be found for the user: {}".format(md.username))

            for val in results:
                logger.info("Value: {}".format(val))
                parts = val.split(':')
                yield {'Name': parts[1], 'ID': parts[0]}
        except Exception as e:
            logger.exception(e)
            raise(e)

if __name__ == '__main__':
    dispatch(GetRemoteData, sys.argv, sys.stdin, sys.stdout, __name__)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Forgive me if my Python isn't quite right.  I'm still fairly new to it.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 16:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329051#M97932</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-10-30T16:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329052#M97933</link>
      <description>&lt;P&gt;You probably want to set local=true in commands.conf so it only runs once on your search head.&lt;/P&gt;

&lt;P&gt;If still not work what's the message you get in stderr?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 12:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329052#M97933</guid>
      <dc:creator>peterchenadded</dc:creator>
      <dc:date>2017-10-31T12:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329053#M97934</link>
      <description>&lt;P&gt;Unfortunately, this didn't work.  As for errors, I'm not getting any.  The only thing I see coming from stderr in the search log are messages from my logger.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 16:12:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329053#M97934</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-10-31T16:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329054#M97935</link>
      <description>&lt;P&gt;Are you using the Splunk SDK as part of your custom search command? If so, what version of the SDK?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 17:30:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329054#M97935</guid>
      <dc:creator>kchamplin_splun</dc:creator>
      <dc:date>2017-10-31T17:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329055#M97936</link>
      <description>&lt;P&gt;Yes, I am.  Looks like I have 1.6.0-py2.7.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 17:40:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329055#M97936</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-10-31T17:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329056#M97937</link>
      <description>&lt;P&gt;change stderr_dest = log from strderr_dest=true in commands.conf and post the error if there are any. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329056#M97937</guid>
      <dc:creator>svasani_splunk</dc:creator>
      <dc:date>2020-09-29T16:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329057#M97938</link>
      <description>&lt;P&gt;Done, but I'm not seeing any errors.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 17:51:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329057#M97938</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-10-31T17:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329058#M97939</link>
      <description>&lt;P&gt;Did you restart splunk?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 17:52:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329058#M97939</guid>
      <dc:creator>svasani_splunk</dc:creator>
      <dc:date>2017-10-31T17:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329059#M97940</link>
      <description>&lt;P&gt;I was just doing the debug/refresh, but I did restart it was well.  No change.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 18:43:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329059#M97940</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-10-31T18:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329060#M97941</link>
      <description>&lt;P&gt;Have you tried setting local = true in your command.py?&lt;/P&gt;

&lt;P&gt;Your first step should be making sure it runs just on search head once.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 20:42:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329060#M97941</guid>
      <dc:creator>peterchenadded</dc:creator>
      <dc:date>2017-10-31T20:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329061#M97942</link>
      <description>&lt;P&gt;Have you tried adding &lt;CODE&gt;| localop&lt;/CODE&gt; before your command? (You can add &lt;CODE&gt;| localop&lt;/CODE&gt; before anything, even &lt;CODE&gt;| localop | search index=* | head 1000&lt;/CODE&gt;.) You shouldn't need to, but it might be a viable workaround. &lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 01:32:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329061#M97942</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2017-11-01T01:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329062#M97943</link>
      <description>&lt;P&gt;You may want to try using the develop branch of the python SDK for now. There's a known bug for the generating command library and SCP2. You will still need to set distributed to false in your @configuration decorator, ex:&lt;BR /&gt;
@Configuration(distributed=False&lt;/P&gt;

&lt;P&gt;For the develop branch go here:&lt;BR /&gt;
&lt;A href="https://github.com/splunk/splunk-sdk-python/tree/develop"&gt;https://github.com/splunk/splunk-sdk-python/tree/develop&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Reference for the issue: &lt;BR /&gt;
&lt;A href="https://github.com/splunk/splunk-sdk-python/pull/182/commits/edd5d1f2ddf1ab36a253588a7cdd472775c149c6"&gt;https://github.com/splunk/splunk-sdk-python/pull/182/commits/edd5d1f2ddf1ab36a253588a7cdd472775c149c6&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 02:38:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329062#M97943</guid>
      <dc:creator>kchamplin_splun</dc:creator>
      <dc:date>2017-11-01T02:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329063#M97944</link>
      <description>&lt;P&gt;Yes, I did try that, but it didn't work.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 16:30:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329063#M97944</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-11-01T16:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Search Command Fails to Return Results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329064#M97945</link>
      <description>&lt;P&gt;Thanks.  I didn't get a copy of the SDK yet, but I did add the distributed setting (True for now based on the bug) and it's working properly now.  If I can, I'll get the version from the develop branch otherwise I'll wait until a new version is released.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 16:32:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Search-Command-Fails-to-Return-Results/m-p/329064#M97945</guid>
      <dc:creator>caseyra</dc:creator>
      <dc:date>2017-11-01T16:32:57Z</dc:date>
    </item>
  </channel>
</rss>

