<?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 Action Run Splunk Query Issues in Splunk SOAR</title>
    <link>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/539984#M573</link>
    <description>&lt;P&gt;I'm running into an issue where I have multiple artifacts that are being submitted as a Splunk query. Below is my current workflow:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Extract domains from URL&lt;/LI&gt;&lt;LI&gt;Format Splunk query as such: '|inputlookup someCSV.csv | search domain={0}'&lt;/LI&gt;&lt;LI&gt;Run Splunk query&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The issue lies in the Splunk query that is run appears to be appending the artifacts in a comma delimited list rather than individual queries:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;query&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain1.com, domain2.com, domain3.com&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;When i'm expecting the following searches to be run:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;query&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain1.com&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;query&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain2.com&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;query&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain3.com&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Is there a way to construct this so each domain extracted is run in a separate Splunk query?&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2021 16:01:16 GMT</pubDate>
    <dc:creator>wilcompl1334</dc:creator>
    <dc:date>2021-02-15T16:01:16Z</dc:date>
    <item>
      <title>Action Run Splunk Query Issues</title>
      <link>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/539984#M573</link>
      <description>&lt;P&gt;I'm running into an issue where I have multiple artifacts that are being submitted as a Splunk query. Below is my current workflow:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Extract domains from URL&lt;/LI&gt;&lt;LI&gt;Format Splunk query as such: '|inputlookup someCSV.csv | search domain={0}'&lt;/LI&gt;&lt;LI&gt;Run Splunk query&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The issue lies in the Splunk query that is run appears to be appending the artifacts in a comma delimited list rather than individual queries:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;query&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain1.com, domain2.com, domain3.com&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;When i'm expecting the following searches to be run:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;query&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain1.com&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;query&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain2.com&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;query&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain3.com&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Is there a way to construct this so each domain extracted is run in a separate Splunk query?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 16:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/539984#M573</guid>
      <dc:creator>wilcompl1334</dc:creator>
      <dc:date>2021-02-15T16:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Action Run Splunk Query Issues</title>
      <link>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/539987#M574</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/138142"&gt;@wilcompl1334&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I can see you are using a format block due to the {0} item so this is a nice simple one &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;If you wrap your format content like&amp;nbsp; this and use the formatted_data.* output in the run_query block:&lt;/P&gt;&lt;P&gt;%%&lt;BR /&gt;&lt;SPAN&gt;|inputlookup someCSV.csv | search domain={0}&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;%%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You should see in the run_query that Phantom builds the for loop based on the formatted_data.* being recognised as a list object. Without the formatted_data.* it will dump all 3 as a single string.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helps please mark as so, or ask for more assistance.&lt;/P&gt;&lt;P&gt;phanTom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 16:08:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/539987#M574</guid>
      <dc:creator>phanTom</dc:creator>
      <dc:date>2021-02-15T16:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Action Run Splunk Query Issues</title>
      <link>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/540025#M575</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/222170"&gt;@phanTom&lt;/a&gt;Thanks for the help with this, on going question as I'm now seeing the query that is passed actually formatted as such:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;query: "| inputlookup someCSV.csv | search domain=domain1.com | inputlookup someCSV.csv | search domain=domain2.com | inputlookup someCSV.csv | search domain=domain3.com"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Rather than individual queries, it appears it's formatted these all as a single, chained query, and passed it off to Splunk.&lt;/P&gt;&lt;P&gt;I'm not at the terminal any longer, but do I need to loop the run_query block as well with the output of formatted_data.* by doing the same for the input of run_query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%%&lt;/P&gt;&lt;P&gt;{0}&lt;/P&gt;&lt;P&gt;%%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 22:55:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/540025#M575</guid>
      <dc:creator>wilcompl1334</dc:creator>
      <dc:date>2021-02-15T22:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Action Run Splunk Query Issues</title>
      <link>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/540062#M576</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/138142"&gt;@wilcompl1334&lt;/a&gt;&amp;nbsp;you will need to pass in the &lt;STRONG&gt;formatted_data.*&lt;/STRONG&gt; output from the format block into the query field of the&amp;nbsp;&lt;STRONG&gt;run_query&lt;/STRONG&gt; action (as per the diagram).&lt;BR /&gt;&lt;BR /&gt;Try selecting each option and watch the Code in the Playbook Editor tab for the change:&lt;BR /&gt;* If using&amp;nbsp;&lt;STRONG&gt;formatted_data.*&lt;/STRONG&gt; output the code has a for loop to add a single parameter for each item found in the formatted data output&lt;/P&gt;&lt;P&gt;* If using just &lt;STRONG&gt;formatted_data&lt;/STRONG&gt; it passes in the list (built in the format block using %'s) as a single string parameter.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So unless you are doing something custom I am not aware of, simply by using the %%{0}%% method in the format block and selecting the&amp;nbsp;&lt;STRONG&gt;formatted_data.*&lt;/STRONG&gt; datapath in the&amp;nbsp;&lt;STRONG&gt;query&lt;/STRONG&gt; field, Phantom will see each item in the list as a separate parameter and pass them individually into the&amp;nbsp;&lt;STRONG&gt;run_query&amp;nbsp;&lt;/STRONG&gt;action.&lt;BR /&gt;&lt;BR /&gt;Using the format block with the %%{0}%% in will create:&lt;BR /&gt;&lt;SPAN&gt;| inputlookup someCSV.csv | search domain=domain1.com&lt;BR /&gt;| inputlookup someCSV.csv | search domain=domain2.com&lt;BR /&gt;| inputlookup someCSV.csv | search domain=domain3.com&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;If you pass it in as just &lt;STRONG&gt;formatted_data&lt;/STRONG&gt; then the code will look like this:&lt;BR /&gt;&lt;BR /&gt;# build parameters list for 'run_query_1' call&lt;BR /&gt;parameters.append({&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 'command': "search",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 'query': formatted_data_1,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 'display': "",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 'parse_only': "",&lt;BR /&gt;})&lt;BR /&gt;&lt;BR /&gt;However if you use the f&lt;STRONG&gt;ormatted_data.*&lt;/STRONG&gt; it will/should change to this:&lt;BR /&gt;# build parameters list for 'run_query_1' call&lt;BR /&gt;&lt;STRONG&gt;for formatted_part_1 in formatted_data_1:&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; parameters.append({&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'command': "search",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'query': formatted_part_1,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'display': "",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'parse_only': "",&lt;BR /&gt;})&lt;BR /&gt;&lt;BR /&gt;I am 100% sure, again unless you are doing something custom I am not aware of, this will work for you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 09:07:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/540062#M576</guid>
      <dc:creator>phanTom</dc:creator>
      <dc:date>2021-02-16T09:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Action Run Splunk Query Issues</title>
      <link>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/589423#M807</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am currently working on a similar task that passing the formatted block value to Splunk query to get an out put required for the next action.&amp;nbsp; My search query&lt;/P&gt;&lt;P&gt;&amp;nbsp;|inputlookup agentid.csv | search hostname=hostname1| fields agentid&lt;/P&gt;&lt;P&gt;My format block configured as below,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Template&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{0}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Template Parameters&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;0 = get_variables_2:action_result.data.*.Computer ID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you please advise me how to pass this computer ID to my Splunk&amp;nbsp;query as&amp;nbsp; mentioned above?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 22:48:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-SOAR/Action-Run-Splunk-Query-Issues/m-p/589423#M807</guid>
      <dc:creator>jesuamal</dc:creator>
      <dc:date>2022-03-16T22:48:46Z</dc:date>
    </item>
  </channel>
</rss>

