<?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: Execute Splunk SPL in custom command in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-execute-Splunk-SPL-with-the-results-from-a-custom-command/m-p/418257#M7306</link>
    <description>&lt;P&gt;Hi @randomforests09 &lt;/P&gt;

&lt;P&gt;You can refer the following links for help in building a custom command:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/SP-CAAAFFT"&gt;http://dev.splunk.com/view/SP-CAAAFFT&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/custom-spl/SP-CAAAFG3"&gt;http://dev.splunk.com/view/custom-spl/SP-CAAAFG3&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What I suggest is, you form the whole query directly in your python script. Then execute the search from the script itself. &lt;BR /&gt;
you will find a few examples here: &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEE5"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEE5&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Do let me know if that helps.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2019 07:15:36 GMT</pubDate>
    <dc:creator>pramit46</dc:creator>
    <dc:date>2019-06-18T07:15:36Z</dc:date>
    <item>
      <title>How to execute Splunk SPL with the results from a custom command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-execute-Splunk-SPL-with-the-results-from-a-custom-command/m-p/418255#M7304</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Im building my first own Splunk app with python. Now I'm asking if it's possible to execute Splunk SPL with the records I receive?&lt;/P&gt;
&lt;P&gt;An example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| input lookup data.csv | fields computer user bytes location | mycommand&lt;/LI-CODE&gt;
&lt;P&gt;Now "mycommand" receives the data in a python script.&lt;/P&gt;
&lt;P&gt;Python -&amp;gt; execute "| where bytes &amp;gt; 7000"&lt;/P&gt;
&lt;P&gt;Now the command should return the data.csv with bytes higher than 7000. The filtering was executed on the app.&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 23:22:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-execute-Splunk-SPL-with-the-results-from-a-custom-command/m-p/418255#M7304</guid>
      <dc:creator>randomforests09</dc:creator>
      <dc:date>2020-06-17T23:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Splunk SPL in custom command</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-execute-Splunk-SPL-with-the-results-from-a-custom-command/m-p/418256#M7305</link>
      <description>&lt;P&gt;You may get more mileage out of an existing solution in Splunk by using a search macro instead a python script to execute more SPL.  Check out a previously solved answer where a macro is created that takes in a token which passes through the value to the SPL: &lt;A href="https://answers.splunk.com/answers/747953/can-i-execute-several-functions-with-a-single-perh.html#answer-747956"&gt;https://answers.splunk.com/answers/747953/can-i-execute-several-functions-with-a-single-perh.html#answer-747956&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Your example would then be this using the logic in that solution:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup data.csv
| fields computer user bytes location 
| ` mycommand(7000)`
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jun 2019 19:44:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-execute-Splunk-SPL-with-the-results-from-a-custom-command/m-p/418256#M7305</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-06-11T19:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Splunk SPL in custom command</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-execute-Splunk-SPL-with-the-results-from-a-custom-command/m-p/418257#M7306</link>
      <description>&lt;P&gt;Hi @randomforests09 &lt;/P&gt;

&lt;P&gt;You can refer the following links for help in building a custom command:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/SP-CAAAFFT"&gt;http://dev.splunk.com/view/SP-CAAAFFT&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/custom-spl/SP-CAAAFG3"&gt;http://dev.splunk.com/view/custom-spl/SP-CAAAFG3&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What I suggest is, you form the whole query directly in your python script. Then execute the search from the script itself. &lt;BR /&gt;
you will find a few examples here: &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEE5"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEE5&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Do let me know if that helps.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 07:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-execute-Splunk-SPL-with-the-results-from-a-custom-command/m-p/418257#M7306</guid>
      <dc:creator>pramit46</dc:creator>
      <dc:date>2019-06-18T07:15:36Z</dc:date>
    </item>
  </channel>
</rss>

