<?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 Command Protocol Version 2 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/626058#M217606</link>
    <description>&lt;P&gt;Ha, yep, I had to guess this myself. The custom search commands (or splunklib in general) docs could use some work.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jan 2023 20:38:51 GMT</pubDate>
    <dc:creator>spunk_enthusias</dc:creator>
    <dc:date>2023-01-05T20:38:51Z</dc:date>
    <item>
      <title>Custom Command Protocol Version 2-What needs to be changed when switching from version 1 to version 2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230036#M68174</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am currently a little bit stuck ...&lt;/P&gt;
&lt;P&gt;Commands.conf looks like this:&lt;BR /&gt;[tc]&lt;BR /&gt;chunked = true&lt;BR /&gt;filename = tc.py&lt;/P&gt;
&lt;P&gt;[t]&lt;BR /&gt;retainsevents = true&lt;BR /&gt;streaming = true&lt;BR /&gt;filename = t.py&lt;/P&gt;
&lt;P&gt;tc is the same command as t but it should use protocol version 2 instead of 1&lt;BR /&gt;The version 1 script works but when using the version 2 script, it just says&lt;BR /&gt;"Could not locate the time (_time) field on some results returned from the external search command 'tc'"&lt;/P&gt;
&lt;P&gt;Documentation on version 2 is a little bit sketchy so, &lt;BR /&gt;--&amp;gt; what needs to be changed when switching from version 1 to version 2? &lt;BR /&gt;--&amp;gt; is there a sample custom streaming command for version 2 ?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 04:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230036#M68174</guid>
      <dc:creator>pinVie</dc:creator>
      <dc:date>2023-01-06T04:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Command Protocol Version 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230037#M68175</link>
      <description>&lt;P&gt;Well, there's nothing wrong with your configuration. I can't look into the Python script or the query so it's really hard to debug. As inspiration you might want to look a what others wrote, e.g.: &lt;A href="https://answers.splunk.com/answers/387430/cant-we-use-a-custom-search-command-with-stats-in.html"&gt;https://answers.splunk.com/answers/387430/cant-we-use-a-custom-search-command-with-stats-in.html&lt;/A&gt;&lt;BR /&gt;
Hope this helps...&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 08:39:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230037#M68175</guid>
      <dc:creator>gwobben</dc:creator>
      <dc:date>2016-10-05T08:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Command Protocol Version 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230038#M68176</link>
      <description>&lt;P&gt;There are some great examples in the Python SDK:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://github.com/splunk/splunk-sdk-python/tree/master/examples/searchcommands_app"&gt;https://github.com/splunk/splunk-sdk-python/tree/master/examples/searchcommands_app&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1964i0BD8FE6C46CFC040/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;At time of writing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;├── bin
│   ├── splunklib
│   │   └── searchcommands ....... splunklib.searchcommands module
│   ├── countmatches.py .......... CountMatchesCommand implementation
│   ├── generatetext.py .......... GenerateTextCommand implementation
│   ├── pypygeneratetext.py ...... Executes generatetext.py with PyPy
│   ├── simulate.py .............. SimulateCommand implementation
│   ├── sum.py ................... SumCommand implementation
│   └── 
├── default
│   ├── data
│   │   └── ui
│   │       └── nav
│   │           └── default.xml ..
│   ├── app.conf ................. Used by Splunk to maintain app state [1]
│   ├── commands.conf ............ Search command configuration [2]
│   ├── logging.conf ............. Python logging[3] configuration in ConfigParser[4] format
│   └── searchbnf.conf ........... Search assistant configuration [5]
└── metadata
    └── local.meta ............... Permits the search assistant to use searchbnf.conf[6]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Oct 2016 15:52:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230038#M68176</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2016-10-05T15:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Command Protocol Version 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230039#M68177</link>
      <description>&lt;P&gt;I had the same questions. The &lt;A href="http://docs.splunk.com/DocumentationStatic/PythonSDK/1.6.0/searchcommands.html"&gt;online documentation&lt;/A&gt; provides  not helpful advice like:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1965iE7FE82AEF7B777B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Turns out it's a problem with their documentation parsing from the source code. You can find this info in the comments of splunklib/searchcommands/generating_command.py. eg:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Reporting Generating command
============================

Commands configured like this will run as the first command on a search head on the reports pipeline.

+----------+---------------------------------------------------+------+
| Pipeline | ...  | SCP 2                                             |
+==========+=...==+===================================================+
| events   | ...  | Add this configuration setting to your command    |
|          | ...  | setting to your command class:                    |
|          | ...  |                                                   |
|          | ...  | .. code-block:: python                            |
|          | ...  |     @Configuration(type='reporting')              |
|          | ...  |     class SomeCommand(GeneratingCommand)          |
|          | ...  |         ...                                       |
|          | ...  |                                                   |
|          | ...  |                                                   |
|          | ...  |                                                   |
|          | ...  |                                                   |
|          | ...  |                                                   |
|          | ...  |                                                   |
+----------+---------------------------------------------------+------+
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2017 22:04:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230039#M68177</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2017-03-02T22:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Command Protocol Version 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230040#M68178</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;

&lt;P&gt;is the now maybe a other documentation out, which explains the interface?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 06:38:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230040#M68178</guid>
      <dc:creator>ays7abt</dc:creator>
      <dc:date>2017-04-20T06:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Command Protocol Version 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230041#M68179</link>
      <description>&lt;P&gt;I tried to load the SDK for Python and encountered a syntax error because the SDK was created using Python 2.7 and I am using Python 3.5. Am I doing something wrong? I loaded the SDK egg that has a time stamp of 2016. Is there a new version of the SDK?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 19:03:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230041#M68179</guid>
      <dc:creator>liujie</dc:creator>
      <dc:date>2018-02-20T19:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Command Protocol Version 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230042#M68180</link>
      <description>&lt;P&gt;Hi liujie&lt;/P&gt;

&lt;P&gt;This question was posted 2 years ago. If none of the answers were able to help you with your question, please post a new question so you can get maximum exposure and help.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 19:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/230042#M68180</guid>
      <dc:creator>Anam</dc:creator>
      <dc:date>2018-02-20T19:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Command Protocol Version 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/626058#M217606</link>
      <description>&lt;P&gt;Ha, yep, I had to guess this myself. The custom search commands (or splunklib in general) docs could use some work.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 20:38:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Command-Protocol-Version-2-What-needs-to-be-changed-when/m-p/626058#M217606</guid>
      <dc:creator>spunk_enthusias</dc:creator>
      <dc:date>2023-01-05T20:38:51Z</dc:date>
    </item>
  </channel>
</rss>

