<?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: How to Include search results as variable in query? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655449#M226416</link>
    <description>&lt;P&gt;You can use the &amp;lt;search&amp;gt; element to define the base search, then use a post-process search within a panel.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.1.0/Viz/PanelreferenceforSimplifiedXML#search" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.1.0/Viz/PanelreferenceforSimplifiedXML#search&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Aug 2023 07:18:21 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2023-08-24T07:18:21Z</dc:date>
    <item>
      <title>How to Include search results as variable in query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655376#M226387</link>
      <description>&lt;P&gt;I'm working on building a dashboard that will take a base report and parse it into different items that can be flagged for review. I've been able to get this to work in a roundabout way, but there is a component that seems to require that the base search be ran again for each of the 10 panels (meaning 10 searches). I have tried using the weekly-ran report as the primary data source and chaining the further refinement from there - by using |search in the chained searches - but it's still running the entire search again. The biggest problem with this is that this specific search can take upwards of 20 minutes to run successfully, meaning that I have 10 cores locked up for 20 minutes... Not ideal.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A way around this would be to run the scheduled reports of this refined data, which is the next place that I went and would like to go - EXCEPT there is some dynamic data that I'm incorporating into the search. I have a dynamic CSV file that contains usernames of users that should be inside the top-level search query (index=production user IN (user-from-csv,user2-from-csv,etc). I can get this to work in the dashboard by storing the search results as a token (after having used inputlookup and format). I can't get this to work in the report, though. Does anybody know how to take a CSV file's contents and store them in a variable OR run a sub-search and pass those results as a string later in the main search?&lt;/P&gt;
&lt;P&gt;non-working view of what I would like to see (understanding that this isn't how Splunk works):&lt;/P&gt;
&lt;P&gt;|eval included-users=inputlookup included-users.csv&lt;BR /&gt;index=production user IN (included-users) action=success&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 19:57:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655376#M226387</guid>
      <dc:creator>dwelbba00</dc:creator>
      <dc:date>2023-08-23T19:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Include search results as variable in query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655380#M226390</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/259933"&gt;@dwelbba00&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the results to display in each panel are always the same, you could use a Post Process Search, in few words run the search once and disaply results in more manels, eventually with additional filtere or displaying only a subsear of fields in each panel.&lt;/P&gt;&lt;P&gt;You can find more infos on this at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.1.0/Viz/Savedsearches#Post-process_searches_2" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.1.0/Viz/Savedsearches#Post-process_searches_2&lt;/A&gt;&amp;nbsp;or installing and using the Splunk Dashboard Examples App (&lt;A href="https://splunkbase.splunk.com/app/1603" target="_blank"&gt;https://splunkbase.splunk.com/app/1603&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 16:19:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655380#M226390</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-08-23T16:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Include search results as variable in query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655394#M226394</link>
      <description>&lt;P&gt;They aren't, unfortunately. I could schedule these searches to run during off-times if I could find a way to incorporate the inputlookup as part of the query. That's the direction I'm going now. Is it possible to incorporate a CSV file into a query as parameters?&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;index=production user IN (user1-from-csv,user2-from-csv,...)&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 17:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655394#M226394</guid>
      <dc:creator>dwelbba00</dc:creator>
      <dc:date>2023-08-23T17:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to Include search results as variable in query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655429#M226409</link>
      <description>&lt;P&gt;This is much easier to solve in Dashboard Studio. &amp;nbsp;You can define a base search for the entire dashboard, and add presentations and filtering as chain searches. &amp;nbsp;See&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/DashStudio/dsChain#Chain_searches_together_with_a_base_search_and_chain_searches" target="_blank" rel="noopener"&gt;Chain searches together with a base search and chain searches&lt;/A&gt;. &amp;nbsp;Base search is performed only once. (You may ask it to auto refresh like in Simple XML although I haven't looked.)&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/DashStudio/IntroFrame#Data_use" target="_blank" rel="noopener"&gt;Data use&lt;/A&gt;&amp;nbsp;in intro to Dashboard Studio indicates that Simple XML can also use base search and chain search. &amp;nbsp;But I cannot find documentation.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 02:49:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655429#M226409</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-08-24T02:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to Include search results as variable in query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655449#M226416</link>
      <description>&lt;P&gt;You can use the &amp;lt;search&amp;gt; element to define the base search, then use a post-process search within a panel.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.1.0/Viz/PanelreferenceforSimplifiedXML#search" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.1.0/Viz/PanelreferenceforSimplifiedXML#search&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 07:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655449#M226416</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-08-24T07:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to Include search results as variable in query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655458#M226417</link>
      <description>&lt;P&gt;You can set a token in the done handler of the base search to save the job sid, and then use loadjob to retrieve the results (multiple times)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search id="base"&amp;gt;
  &amp;lt;query base="base"&amp;gt;
    ``` your base search ```
  &amp;lt;\query&amp;gt;
  &amp;lt;done&amp;gt;
    &amp;lt;condition&amp;gt;
      &amp;lt;set token="basesid"&amp;gt;$job.sid$&amp;lt;/set&amp;gt;
    &amp;lt;/condition&amp;gt;
  &amp;lt;/done&amp;gt;
&amp;lt;search&amp;gt;

&amp;lt;panel&amp;gt;
  &amp;lt;table&amp;gt;
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;
        | loadjob $basesid$
        ``` further processing of results ```
      &amp;lt;/query&amp;gt;
    &amp;lt;/search&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/panel&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 24 Aug 2023 09:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Include-search-results-as-variable-in-query/m-p/655458#M226417</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-24T09:08:54Z</dc:date>
    </item>
  </channel>
</rss>

