<?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 get custom search command to run local on search head in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/497903#M138717</link>
    <description>&lt;P&gt;While not a solution, I've gotten around the problem by putting a sort command in front of my command. The sort can only run on the search head which forces my command to the search head as well.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2020 14:06:49 GMT</pubDate>
    <dc:creator>scottsavareseat</dc:creator>
    <dc:date>2020-01-30T14:06:49Z</dc:date>
    <item>
      <title>How to get custom search command to run local on search head</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/497902#M138716</link>
      <description>&lt;P&gt;I'm trying to use the python sdk to build a custom search command. In my commands.conf, I have "chunked = true" set. I should therefore be using version 2 of the search command language. In my python script, I have the following lines:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;from splunklib.searchcommands import dispatch, StreamingCommand, Configuration
@Configuration(distributed=False,type='streaming')    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I remove the type variable from the configuration decoration, the command tries to execute on all my indexers. However, I want it to run local on the search head for now so I can test it and fix issues without having to deploy it all over the place. When I add the type variable, I get the following error messages. There is a valueerror saying that I can't set the type variable. Is there a way around this problem?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;01-29-2020 20:07:03.600 INFO  ChunkedExternProcessor - Running process: /opt/splunk/bin/python3.7 /opt/splunk/etc/apps/myapp/bin/myapp.py
01-29-2020 20:07:03.710 ERROR ChunkedExternProcessor - stderr: Traceback (most recent call last):
01-29-2020 20:07:03.710 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/etc/apps/myapp/bin/myapp.py", line 9, in &amp;lt;module&amp;gt;
01-29-2020 20:07:03.710 ERROR ChunkedExternProcessor - stderr:     class myappCommand(StreamingCommand):
01-29-2020 20:07:03.710 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/etc/apps/myapp/bin/lib/splunklib/searchcommands/decorators.py", line 84, in __call__
01-29-2020 20:07:03.710 ERROR ChunkedExternProcessor - stderr:     ConfigurationSetting.fix_up(o.ConfigurationSettings, self.settings)
01-29-2020 20:07:03.710 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/etc/apps/myapp/bin/lib/splunklib/searchcommands/decorators.py", line 193, in fix_up
01-29-2020 20:07:03.710 ERROR ChunkedExternProcessor - stderr:     raise ValueError('The value of configuration setting {} is fixed'.format(name))
01-29-2020 20:07:03.710 ERROR ChunkedExternProcessor - stderr: ValueError: The value of configuration setting type is fixed
01-29-2020 20:07:03.720 ERROR ChunkedExternProcessor - EOF while attempting to read transport header
01-29-2020 20:07:03.721 ERROR ChunkedExternProcessor - Error in 'myapp' command: External search command exited unexpectedly with non-zero error code 1.
01-29-2020 20:07:03.721 ERROR SearchPhaseGenerator - Fallback to two phase search failed:Error in 'myapp' command: External search command exited unexpectedly with non-zero error code 1.
01-29-2020 20:07:03.722 ERROR SearchOrchestrator - Error in 'myapp' command: External search command exited unexpectedly with non-zero error code 1.
01-29-2020 20:07:03.722 ERROR SearchStatusEnforcer - sid:1580328423.9 Error in 'myapp' command: External search command exited unexpectedly with non-zero error code 1.
01-29-2020 20:07:03.722 INFO  SearchStatusEnforcer - State changed to FAILED due to: Error in 'myapp' command: External search command exited unexpectedly with non-zero error code 1.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2020 20:15:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/497902#M138716</guid>
      <dc:creator>scottsavareseat</dc:creator>
      <dc:date>2020-01-29T20:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get custom search command to run local on search head</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/497903#M138717</link>
      <description>&lt;P&gt;While not a solution, I've gotten around the problem by putting a sort command in front of my command. The sort can only run on the search head which forces my command to the search head as well.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 14:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/497903#M138717</guid>
      <dc:creator>scottsavareseat</dc:creator>
      <dc:date>2020-01-30T14:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get custom search command to run local on search head</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/497904#M138718</link>
      <description>&lt;P&gt;If its just for testing that you can try and put "| localop " prior to the command you want to run specifically on the search head.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 02:30:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/497904#M138718</guid>
      <dc:creator>Lucas_K</dc:creator>
      <dc:date>2020-01-31T02:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get custom search command to run local on search head</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/507693#M141918</link>
      <description>&lt;P&gt;Github shows this fix for distributed flag not working properly:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/splunk/splunk-sdk-python/pull/182/files" target="_blank"&gt;https://github.com/splunk/splunk-sdk-python/pull/182/files&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The fix seems to be in the current splunklib.&amp;nbsp; &amp;nbsp;Still not sure how to properly use the distributed flag since I cannot set type=streaming to force splunklib to respect distributed=true/false&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 22:35:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-custom-search-command-to-run-local-on-search-head/m-p/507693#M141918</guid>
      <dc:creator>onthebay</dc:creator>
      <dc:date>2020-07-06T22:35:13Z</dc:date>
    </item>
  </channel>
</rss>

