<?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: Why do I get error message &amp;quot;Unknown search command&amp;quot; for my custom search command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356842#M164213</link>
    <description>&lt;P&gt;Splunk has the read/exec permission on the script ? Sorry for asking obvious questions but it could be the reason&lt;/P&gt;</description>
    <pubDate>Sat, 23 Dec 2017 15:19:33 GMT</pubDate>
    <dc:creator>DavidHourani</dc:creator>
    <dc:date>2017-12-23T15:19:33Z</dc:date>
    <item>
      <title>Why do I get error message "Unknown search command" for my custom search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356839#M164210</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;

&lt;P&gt;I am using Splunk Enterprise 6.6.3 on Windows 10 and trying to get a custom search to work.  I've followed this manual &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.6.3/Search/Writeasearchcommand"&gt;http://docs.splunk.com/Documentation/Splunk/6.6.3/Search/Writeasearchcommand&lt;/A&gt; along with various answer threads, but I cannot get it to work.  I have a script that will calculate business hours between two timestamps.  Splunk setup is as follows:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Custom python script totalbusinesshours.py is located in &lt;CODE&gt;$SPLUNK_HOME/etc/apps/&amp;lt;app_name&amp;gt;/bin/&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;commands.conf located in &lt;CODE&gt;$SPLUNK_HOME/etc/apps/&amp;lt;app_name&amp;gt;/local/&lt;/CODE&gt; and encoded with &lt;CODE&gt;UTF-8-BOM&lt;/CODE&gt; (like the other conf files) contains the following stanza: &lt;/P&gt;

&lt;P&gt;[totalbusinesshours]&lt;BR /&gt;
filename = totalbusinesshours.py&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;After restarting the server I run the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | totalbusinesshours StartTime EndTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which produces this error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Search Factory: Unknown search command 'totalbusinesshours'.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've also tried the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | script totalbusinesshours StartTime EndTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but this produces a different error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'script' command: The external search command 'totalbusinesshours' does not exist in commands.conf.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;According to the documentation everything is set up correctly, but nothing works.&lt;/P&gt;

&lt;P&gt;Am I missing something?  Maybe some flag somewhere to enable the running of external search commands?&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;

&lt;P&gt;Thank you and best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Sat, 23 Dec 2017 09:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356839#M164210</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-12-23T09:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get error message "Unknown search command" for my custom search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356840#M164211</link>
      <description>&lt;P&gt;Hi andrew,&lt;/P&gt;

&lt;P&gt;Assuming your python script works and the splunk user has exec permissions. Did you configure &lt;STRONG&gt;commands.conf&lt;/STRONG&gt; properly ? Can you post an extract here ?&lt;/P&gt;

&lt;P&gt;Also check if you can see your command in : "Advanced search » Search commands". It could be that the permissions are set to app and you're trying to run it in another app.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Sat, 23 Dec 2017 11:28:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356840#M164211</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-12-23T11:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get error message "Unknown search command" for my custom search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356841#M164212</link>
      <description>&lt;P&gt;@DavidHourani&lt;BR /&gt;
Thanks for replying.  The &lt;CODE&gt;commands.conf&lt;/CODE&gt; file has a single stanza and looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[totalbusinesshours]
filename = totalbusinesshours.py
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It is located in $SPLUNK_HOME/etc/apps/&lt;STRONG&gt;local&lt;/STRONG&gt;/ and encoded with UTF-8-BOM (like the other conf files).&lt;/P&gt;

&lt;P&gt;When I go to Advanced search » Search commands, I do not see an entry.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Dec 2017 15:14:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356841#M164212</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-12-23T15:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get error message "Unknown search command" for my custom search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356842#M164213</link>
      <description>&lt;P&gt;Splunk has the read/exec permission on the script ? Sorry for asking obvious questions but it could be the reason&lt;/P&gt;</description>
      <pubDate>Sat, 23 Dec 2017 15:19:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356842#M164213</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-12-23T15:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get error message "Unknown search command" for my custom search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356843#M164214</link>
      <description>&lt;P&gt;@DavidHourani&lt;BR /&gt;
I'm running Splunk 6.6.3 on Windows 10.  The splunkd service is running with local system account that has admin rights, and AFAIK it has all permissions.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Dec 2017 15:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-error-message-quot-Unknown-search-command-quot-for/m-p/356843#M164214</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-12-23T15:27:23Z</dc:date>
    </item>
  </channel>
</rss>

