<?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: Is it possible to use base search in append sub search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357537#M105751</link>
    <description>&lt;P&gt;This is not very usefull. Once you run the search base and calls it later, the search comes with " | " .&lt;/P&gt;

&lt;P&gt;In the example, index=xxx sourcetype=zzzz must be together, if you split them as "index=xxx | sourcetype=zzz" it will break the search. &lt;/P&gt;

&lt;P&gt;I'm facing this problema right now and still doesn't figured out how to fix it.&lt;/P&gt;

&lt;P&gt;I have few querys such as: &lt;/P&gt;

&lt;P&gt;1 search - a a b b c c d d e e &lt;BR /&gt;
2 search - a a b b c c d d &lt;BR /&gt;
3 search - a a c c d d &lt;BR /&gt;
4 search - a a d d e e &lt;/P&gt;

&lt;P&gt;a = index&lt;BR /&gt;
b = sourcetype&lt;BR /&gt;
c = user&lt;BR /&gt;
d = host&lt;/P&gt;

&lt;P&gt;i tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt;index=_internal&amp;lt;/query&amp;gt;
&amp;lt;earliest&amp;gt;-60m@m&amp;lt;/earliest&amp;gt;
&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;



&amp;lt;query&amp;gt;sourcetype=splunkd&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But got the result: &lt;/P&gt;

&lt;P&gt;index=_internal | sourcetype=splunkd &lt;/P&gt;

&lt;P&gt;and the error: unknow command sourcetype&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2019 20:14:50 GMT</pubDate>
    <dc:creator>vinigreen</dc:creator>
    <dc:date>2019-08-28T20:14:50Z</dc:date>
    <item>
      <title>Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357524#M105738</link>
      <description>&lt;P&gt;I want to use base search for query2 as well&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/4305i7DA0366A83475C43/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;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 08:51:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357524#M105738</guid>
      <dc:creator>ny34940</dc:creator>
      <dc:date>2018-02-06T08:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357525#M105739</link>
      <description>&lt;P&gt;You can define your query in a token that can be set in an init section of your dashboard. Here's an example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  ...
  &amp;lt;init&amp;gt;
    &amp;lt;set token="query"&amp;gt;your repetitve search&amp;lt;/set&amp;gt;
  &amp;lt;/init&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;event&amp;gt;
        &amp;lt;title&amp;gt;Tokenized Based Query&amp;lt;/title&amp;gt;
        &amp;lt;search id="baseSearch"&amp;gt;
          &amp;lt;query&amp;gt;$query$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="list.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/event&amp;gt;
      &amp;lt;event&amp;gt;
        &amp;lt;title&amp;gt;Tokenized Append Search&amp;lt;/title&amp;gt;
        &amp;lt;search base="baseSearch"&amp;gt;
          &amp;lt;query&amp;gt;| $query$&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="list.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/event&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that you don't need to state the base search in your postprocess seach.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:10:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357525#M105739</guid>
      <dc:creator>bojanisch</dc:creator>
      <dc:date>2018-02-06T09:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357526#M105740</link>
      <description>&lt;P&gt;Thanks for the quick reply!&lt;/P&gt;

&lt;P&gt;I have few doubts regarding how base search works.When we use base search does it run every time we use it in post process search or it run once and the data is then used in every search?&lt;BR /&gt;
Here also does the query in the token value is executed once or every time?&lt;/P&gt;

&lt;P&gt;Actually my base search is dbxquery and I don't want to hit the database again and again. &lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:34:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357526#M105740</guid>
      <dc:creator>ny34940</dc:creator>
      <dc:date>2018-02-06T09:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357527#M105741</link>
      <description>&lt;P&gt;You can try chained post-process searches &lt;/P&gt;

&lt;P&gt;have a look at this doc&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/Savedsearches#Examples_2"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/Savedsearches#Examples_2&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search id="baseSearch"&amp;gt;
   &amp;lt;query&amp;gt;index=_internal&amp;lt;/query&amp;gt;
   &amp;lt;earliest&amp;gt;-60m@m&amp;lt;/earliest&amp;gt;
   &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;

&amp;lt;search base="baseSearch" id="post_process_1"&amp;gt;
   &amp;lt;query&amp;gt;sourcetype=splunkd&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;

&amp;lt;search base="post_process_1" id="post_process_2"&amp;gt;
   &amp;lt;query&amp;gt;stats count&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:42:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357527#M105741</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-02-06T09:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357528#M105742</link>
      <description>&lt;P&gt;The base search will only run once and the post-process search will use the cached base search as starting point for its post-process search. However if your base search needs to be refreshed it will influence all post-process searches that are based on it. &lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:50:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357528#M105742</guid>
      <dc:creator>bojanisch</dc:creator>
      <dc:date>2018-02-06T09:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357529#M105743</link>
      <description>&lt;P&gt;I forgot to mention I can't set the query in init section as it is using token values from from input and those changes will not be reflected in the query if it is defined in init section:(&lt;/P&gt;

&lt;P&gt;So there is no direct way to use base search in append?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 10:10:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357529#M105743</guid>
      <dc:creator>ny34940</dc:creator>
      <dc:date>2018-02-06T10:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357530#M105744</link>
      <description>&lt;P&gt;Thanks for your response however I need to use base search inside append sub search&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 10:13:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357530#M105744</guid>
      <dc:creator>ny34940</dc:creator>
      <dc:date>2018-02-06T10:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357531#M105745</link>
      <description>&lt;P&gt;Okay then how about setting the token in the done section of the search? Although I could not find a solution to get the real search string, try this with the optimizedSearch string as shown:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;panel&amp;gt;
  &amp;lt;event&amp;gt;
    &amp;lt;title&amp;gt;Base Search&amp;lt;/title&amp;gt;
    &amp;lt;search id="baseSearch"&amp;gt;
      &amp;lt;query&amp;gt;index=_internal | where $earliest$ &amp;amp;gt; 0&amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;done&amp;gt;
        &amp;lt;set token="query"&amp;gt;$job.optimizedSearch$&amp;lt;/set&amp;gt;
      &amp;lt;/done&amp;gt;
    &amp;lt;/search&amp;gt;
    &amp;lt;option name="list.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
  &amp;lt;/event&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;panel&amp;gt;
  &amp;lt;event&amp;gt;
    &amp;lt;title&amp;gt;Double used Base Search&amp;lt;/title&amp;gt;
    &amp;lt;search base="baseSearch"&amp;gt;
      &amp;lt;query&amp;gt;$query$&amp;lt;/query&amp;gt;
    &amp;lt;/search&amp;gt;
    &amp;lt;option name="list.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
  &amp;lt;/event&amp;gt;
&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Feb 2018 12:30:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357531#M105745</guid>
      <dc:creator>bojanisch</dc:creator>
      <dc:date>2018-02-06T12:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357532#M105746</link>
      <description>&lt;P&gt;Sadly this isn't working in my dashboard.&lt;/P&gt;

&lt;P&gt;I have one concern though. Even if we somehow manage to pass the query as a token wouldn't it be equivalent to writing the query itself. I don't think it is not going to improve the performance. I wanted to use the base search in append so that I don't have to run the query twice and the performance of my dashboard can be improved.Please correct me if I am wrong.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 13:43:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357532#M105746</guid>
      <dc:creator>ny34940</dc:creator>
      <dc:date>2018-02-07T13:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357533#M105747</link>
      <description>&lt;P&gt;Here's a run-anywhere example (concept courtesy of @sowings):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;616340&amp;lt;/label&amp;gt;
  &amp;lt;search id="subsearch_results"&amp;gt;
    &amp;lt;query&amp;gt;index=_internal | stats count BY sourcetype | table sourcetype&amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;condition&amp;gt;
        &amp;lt;set token="subsearch_sid"&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;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;event&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal [| loadjob $subsearch_sid$]&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="list.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/event&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The key is having your base search set a token with its &lt;CODE&gt;sid&lt;/CODE&gt; and fetching its results in the subsearch via &lt;CODE&gt;loadjob&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 21:43:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357533#M105747</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-02-07T21:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357534#M105748</link>
      <description>&lt;P&gt;Thank you so much!!!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 05:52:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357534#M105748</guid>
      <dc:creator>ny34940</dc:creator>
      <dc:date>2018-02-08T05:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357535#M105749</link>
      <description>&lt;P&gt;Wow!! This is such a COOL trick!! This is the kind of stuff that dreams are made of! Thank you for sharing!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 02:39:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357535#M105749</guid>
      <dc:creator>abulco01</dc:creator>
      <dc:date>2018-09-05T02:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357536#M105750</link>
      <description>&lt;P&gt;You can use this to have in effect multiple separate base searches that feed into one, and you can also use this to conditionally only run base searches that haven't already been ran&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/738095/dashboard-search-optimization-only-run-searches-wh.html"&gt;https://answers.splunk.com/answers/738095/dashboard-search-optimization-only-run-searches-wh.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 16:36:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357536#M105750</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2019-04-10T16:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357537#M105751</link>
      <description>&lt;P&gt;This is not very usefull. Once you run the search base and calls it later, the search comes with " | " .&lt;/P&gt;

&lt;P&gt;In the example, index=xxx sourcetype=zzzz must be together, if you split them as "index=xxx | sourcetype=zzz" it will break the search. &lt;/P&gt;

&lt;P&gt;I'm facing this problema right now and still doesn't figured out how to fix it.&lt;/P&gt;

&lt;P&gt;I have few querys such as: &lt;/P&gt;

&lt;P&gt;1 search - a a b b c c d d e e &lt;BR /&gt;
2 search - a a b b c c d d &lt;BR /&gt;
3 search - a a c c d d &lt;BR /&gt;
4 search - a a d d e e &lt;/P&gt;

&lt;P&gt;a = index&lt;BR /&gt;
b = sourcetype&lt;BR /&gt;
c = user&lt;BR /&gt;
d = host&lt;/P&gt;

&lt;P&gt;i tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt;index=_internal&amp;lt;/query&amp;gt;
&amp;lt;earliest&amp;gt;-60m@m&amp;lt;/earliest&amp;gt;
&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;



&amp;lt;query&amp;gt;sourcetype=splunkd&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But got the result: &lt;/P&gt;

&lt;P&gt;index=_internal | sourcetype=splunkd &lt;/P&gt;

&lt;P&gt;and the error: unknow command sourcetype&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 20:14:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357537#M105751</guid>
      <dc:creator>vinigreen</dc:creator>
      <dc:date>2019-08-28T20:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357538#M105752</link>
      <description>&lt;P&gt;Wow, but im facing no results found in post processing searches as my base search runs longer, any idea how to resolve this?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 10:53:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357538#M105752</guid>
      <dc:creator>PramodhKumar</dc:creator>
      <dc:date>2020-04-06T10:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use base search in append sub search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357539#M105753</link>
      <description>&lt;P&gt;Pasting this answer into a new dashboard (Splunk Enterprise 8.02) produces:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;" Search is waiting for input..." for about a minute&lt;/LI&gt;
&lt;LI&gt;a list of events rather than a table intended as a result&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Has something changed in Splunk 8 that this no longer works?&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 20:36:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-base-search-in-append-sub-search/m-p/357539#M105753</guid>
      <dc:creator>mitag</dc:creator>
      <dc:date>2020-05-08T20:36:33Z</dc:date>
    </item>
  </channel>
</rss>

