<?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: Best way of making base search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558375#M158608</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236101"&gt;@N-W&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;At first,&amp;nbsp;&lt;/P&gt;&lt;P&gt;there's a strange thing in your base search: how can you have a span of 1 day with an earliest time of 60 minutes?&lt;/P&gt;&lt;P&gt;Anyway, the best way to use a base search is using a transforming command (as e.g. timechart or stats, etc...) so in this way you can limit the number of results,&amp;nbsp; but base searches runs also in the way you used.&lt;/P&gt;&lt;P&gt;Anyway, it's possible to optimize your base search and the others in ths way:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search id="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     index=Test
     | timechart span=30m count(orders) by status
  &amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;and then use the following searches in panels:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     your_search
     | timechart span=1d count(orders) by status
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     | search status=!"Cancelled" 
     | timechart span=1d count(orders) by status
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search&amp;gt;
  &amp;lt;query&amp;gt;
     your_search countryCode="SWE" 
     | timechart span=1d count(orders) by status
  &amp;lt;/query&amp;gt;
  &amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;In which the last one is out of the base search because it uses a field different than status.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jul 2021 09:43:46 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2021-07-06T09:43:46Z</dc:date>
    <item>
      <title>Best way of making base search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558374#M158607</link>
      <description>&lt;P&gt;Hello everyone!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I need some help with figuring out how to make this base search the best way without hitting the 500.000 limit aswell.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search id="base_search"&amp;gt;
  &amp;lt;query&amp;gt;index=Test | fields orders status countryCode
  &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;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since i need it to be used with these different searches:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;search | timechart span=1d count(orders) by status&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;search | timechart span=30m count(orders) by status&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;search status=!"Cancelled" | timechart span=1d count(orders) by status&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;search countryCode="SWE" | timechart span=1d count(orders) by status&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or am I missing something simple? I know base searches needs to be transformative to not hit the cap but how would I do that without making it unable to use the search command for the different things I need later? Like for specific countries etc.?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 09:28:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558374#M158607</guid>
      <dc:creator>N-W</dc:creator>
      <dc:date>2021-07-06T09:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Best way of making base search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558375#M158608</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236101"&gt;@N-W&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;At first,&amp;nbsp;&lt;/P&gt;&lt;P&gt;there's a strange thing in your base search: how can you have a span of 1 day with an earliest time of 60 minutes?&lt;/P&gt;&lt;P&gt;Anyway, the best way to use a base search is using a transforming command (as e.g. timechart or stats, etc...) so in this way you can limit the number of results,&amp;nbsp; but base searches runs also in the way you used.&lt;/P&gt;&lt;P&gt;Anyway, it's possible to optimize your base search and the others in ths way:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search id="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     index=Test
     | timechart span=30m count(orders) by status
  &amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;and then use the following searches in panels:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     your_search
     | timechart span=1d count(orders) by status
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     | search status=!"Cancelled" 
     | timechart span=1d count(orders) by status
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search&amp;gt;
  &amp;lt;query&amp;gt;
     your_search countryCode="SWE" 
     | timechart span=1d count(orders) by status
  &amp;lt;/query&amp;gt;
  &amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;In which the last one is out of the base search because it uses a field different than status.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 09:43:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558375#M158608</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-07-06T09:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Best way of making base search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558379#M158611</link>
      <description>&lt;P&gt;Thank you so much for this! I will try this today&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 10:17:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558379#M158611</guid>
      <dc:creator>N-W</dc:creator>
      <dc:date>2021-07-06T10:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Best way of making base search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558380#M158612</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236101"&gt;@N-W&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, tell me if I can help you more.&lt;/P&gt;&lt;P&gt;If this answer solves your need, please accept it for the other people of Community&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 10:26:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558380#M158612</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-07-06T10:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Best way of making base search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558382#M158613</link>
      <description>&lt;P&gt;Since this base search counts by status in 30m buckets, the subsequent searches should sum the counts into daily totals where appropriate. Using stats in the base search keeps the events by time and status giving the subsequent searches useful events to work with.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search id="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     index=Test
     | bin _time span=30m
     | stats count(orders) as ordercount by _time status
  &amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     your_search
     | timechart span=1d sum(ordercount) as dailytotal by status
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     | search status=!"Cancelled" 
     | timechart span=1d sum(ordercount) as dailytotal by status
  &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;search&amp;gt;
  &amp;lt;query&amp;gt;
     your_search countryCode="SWE" 
     | timechart span=1d sum(ordercount) as dailytotal by status
  &amp;lt;/query&amp;gt;
  &amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;If you include countryCode in the stats as well, you might be able to use the same base search for that panel too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search id="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     index=Test
     | bin _time span=30m
     | stats count(orders) as ordercount by _time status countryCode
  &amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search base="base_search"&amp;gt;
  &amp;lt;query&amp;gt;
     | search countryCode="SWE" 
     | timechart span=1d sum(ordercount) as dailytotal by status
  &amp;lt;/query&amp;gt;
  &amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 11:18:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558382#M158613</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-06T11:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Best way of making base search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558385#M158614</link>
      <description>&lt;P&gt;Thank you i will also try this one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 11:39:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558385#M158614</guid>
      <dc:creator>N-W</dc:creator>
      <dc:date>2021-07-06T11:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Best way of making base search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558501#M158652</link>
      <description>&lt;P&gt;Thank you this answer made it so that i could also use it for diffrent queries without having to dubble the amount of searches&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 06:32:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-way-of-making-base-search/m-p/558501#M158652</guid>
      <dc:creator>N-W</dc:creator>
      <dc:date>2021-07-07T06:32:13Z</dc:date>
    </item>
  </channel>
</rss>

