<?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: Adding python script to search app in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187963#M54164</link>
    <description>&lt;P&gt;Yes, when I do {my search} | uniq I get my expected results however when I do {my search} | test I get:&lt;/P&gt;

&lt;P&gt;Error in 'test' command: This command must be the first command of a search.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jun 2014 19:19:51 GMT</pubDate>
    <dc:creator>bkirk</dc:creator>
    <dc:date>2014-06-04T19:19:51Z</dc:date>
    <item>
      <title>Adding python script to search app</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187961#M54162</link>
      <description>&lt;P&gt;I have python script I want to add to the search app in splunk 5.0.3,  I found some documentation: &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.3/Search/AddthecustomcommandtoSplunk"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.3/Search/AddthecustomcommandtoSplunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Now to make sure I am doing things correctly I copied the uniq.py and called it test.py and modified the commands.conf all in the $SPLUNK_HOME/etc/apps/search folder. &lt;/P&gt;

&lt;P&gt;After restarting splunk I can see the script in:  &lt;STRONG&gt;Manager &amp;gt; Advanced search &amp;gt; Search commands&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;However when I tried to use it I get an error:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Error in 'test' command: This command must be the first command of a search.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Meanwhile uniq work fine, obviously since that was built into splunk.&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2014 13:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187961#M54162</guid>
      <dc:creator>bkirk</dc:creator>
      <dc:date>2014-06-04T13:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adding python script to search app</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187962#M54163</link>
      <description>&lt;P&gt;How are you calling the command? Your search should have a leading pipe and your command being the first command; something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| test
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jun 2014 16:12:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187962#M54163</guid>
      <dc:creator>LukeMurphey</dc:creator>
      <dc:date>2014-06-04T16:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Adding python script to search app</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187963#M54164</link>
      <description>&lt;P&gt;Yes, when I do {my search} | uniq I get my expected results however when I do {my search} | test I get:&lt;/P&gt;

&lt;P&gt;Error in 'test' command: This command must be the first command of a search.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2014 19:19:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187963#M54164</guid>
      <dc:creator>bkirk</dc:creator>
      <dc:date>2014-06-04T19:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding python script to search app</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187964#M54165</link>
      <description>&lt;P&gt;Ok I was able to get my custom python script to work however I needed to do the following:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Add my script to the $SPLUNK_HOME/etc/system/bin directory&lt;/LI&gt;
&lt;LI&gt;Modify the $SPLUNK_HOME/etc/system/default/transforms.conf to include the fields:&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;CODE&gt;[myscript]&lt;BR /&gt;
 external_cmd = myscript.py InputField OutputField&lt;BR /&gt;
 fields_list = InputField OutputField&lt;/CODE&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Use my script as follows:&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;CODE&gt;{My Search} |lookup myscript InputField as SearchField |table OutputField&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Thank you,&lt;BR /&gt;
Brian &lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2014 20:24:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-python-script-to-search-app/m-p/187964#M54165</guid>
      <dc:creator>bkirk</dc:creator>
      <dc:date>2014-06-10T20:24:56Z</dc:date>
    </item>
  </channel>
</rss>

