<?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: Optimize Search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451282#M127794</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/23295"&gt;@nickhills&lt;/a&gt; &lt;BR /&gt;
This is my new search&lt;BR /&gt;
    index="caas_oracle_virtual_directory_&lt;EM&gt;" sourcetype="oracle_virtual_directory:&lt;/EM&gt;" earliest=-7d latest=now &lt;BR /&gt;
    | stats count as event_last_week by &lt;EM&gt;time, index, sourcetype &lt;BR /&gt;
    | join type=left sourcetype &lt;BR /&gt;
        [| search index=caas_oracle_virtual_directory&lt;/EM&gt;* sourcetype="oracle_virtual_directory:*" earliest=@d latest=now &lt;BR /&gt;
        | stats count as event_today by _time index, sourcetype &lt;BR /&gt;
        | fields sourcetype, event_today] &lt;BR /&gt;
    | eval half = (event_last_week / 2) &lt;BR /&gt;
    | where half &amp;gt; event_today &lt;BR /&gt;
    | table _time, index, sourcetype, event_last_week, event_today, half &lt;BR /&gt;
    | rename index as "Index" sourcetype as "Source Type", event_today as "Event Today", half as "Threshhold"&lt;/P&gt;

&lt;P&gt;What i want to add now is the time when the treshold has beenn passed.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:47:36 GMT</pubDate>
    <dc:creator>nicxso</dc:creator>
    <dc:date>2020-09-29T23:47:36Z</dc:date>
    <item>
      <title>Optimize Search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451280#M127792</link>
      <description>&lt;P&gt;I have to create an alert where as soon as the number of events at time X has changed. There are two following  scenarios &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;That the number of events at time X has increased dramatically (eg compared to time X - doubled by 7 days)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;That the number of events at time X has decreased dramatically (eg, compared to time X - halved 7 days) &lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I need to count the total events of each sourcetype&lt;/P&gt;

&lt;P&gt;I have the following search for the first scenario&lt;/P&gt;

&lt;P&gt;index=caas_oracle_virtual_directory_* sourcetype="oracle_virtual_directory:&lt;EM&gt;" earliest=-7d latest=now&lt;BR /&gt;
| stats count as event_last_week by index, sourcetype&lt;BR /&gt;
| join type=left sourcetype [&lt;BR /&gt;
|   search index=caas_oracle_virtual_directory_&lt;/EM&gt; sourcetype="oracle_virtual_directory:*" earliest=@d latest=now&lt;BR /&gt;
|   stats count as event_today by index, sourcetype&lt;BR /&gt;
|   fields sourcetype, event_today]&lt;BR /&gt;
| eval half = (event_last_week / 2)&lt;BR /&gt;
| table index, sourcetype, event_last_week, event_today, half&lt;BR /&gt;
| rename index as "Index" sourcetype as "Source Type", event_today as "Event Today", half as "Threshhold"&lt;/P&gt;

&lt;P&gt;Here a picture:&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/270847-test.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Any optimization that i can do to my search, there are over 100 Million events in total. So it takes awhile.&lt;BR /&gt;
Can i make my search run faster ?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:46:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451280#M127792</guid>
      <dc:creator>nicxso</dc:creator>
      <dc:date>2020-09-29T23:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451281#M127793</link>
      <description>&lt;P&gt;Totally untested, and typed on a phone - could be typos!&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=caas_oracle_virtual_directory_ sourcetype="oracle_virtual_directory:" earliest=-7d latest=now&lt;BR /&gt;
| eventstats count as event_last_week by index, sourcetype&lt;BR /&gt;
|search * earliest=@d latest=now&lt;BR /&gt;
| eventstats count as event_today by index, sourcetype&lt;BR /&gt;
| eval half = (event_last_week / 2)&lt;BR /&gt;
| table index, sourcetype, event_last_week, event_today, half&lt;BR /&gt;
| rename index as "Index" sourcetype as "Source Type", event_today as "Event Today", half as "Threshhold"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 10:00:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451281#M127793</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-21T10:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451282#M127794</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/23295"&gt;@nickhills&lt;/a&gt; &lt;BR /&gt;
This is my new search&lt;BR /&gt;
    index="caas_oracle_virtual_directory_&lt;EM&gt;" sourcetype="oracle_virtual_directory:&lt;/EM&gt;" earliest=-7d latest=now &lt;BR /&gt;
    | stats count as event_last_week by &lt;EM&gt;time, index, sourcetype &lt;BR /&gt;
    | join type=left sourcetype &lt;BR /&gt;
        [| search index=caas_oracle_virtual_directory&lt;/EM&gt;* sourcetype="oracle_virtual_directory:*" earliest=@d latest=now &lt;BR /&gt;
        | stats count as event_today by _time index, sourcetype &lt;BR /&gt;
        | fields sourcetype, event_today] &lt;BR /&gt;
    | eval half = (event_last_week / 2) &lt;BR /&gt;
    | where half &amp;gt; event_today &lt;BR /&gt;
    | table _time, index, sourcetype, event_last_week, event_today, half &lt;BR /&gt;
    | rename index as "Index" sourcetype as "Source Type", event_today as "Event Today", half as "Threshhold"&lt;/P&gt;

&lt;P&gt;What i want to add now is the time when the treshold has beenn passed.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:47:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451282#M127794</guid>
      <dc:creator>nicxso</dc:creator>
      <dc:date>2020-09-29T23:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451283#M127795</link>
      <description>&lt;P&gt;You want to try and avoid a 'join' they are horrifically poor performing, which is what I was proposing with 'eventstats' - did you get an opportunity to test my suggestion. I will be back at a PC shortly.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 10:44:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451283#M127795</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-21T10:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451284#M127796</link>
      <description>&lt;P&gt;yeah join is really not a good option here&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 10:49:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451284#M127796</guid>
      <dc:creator>nicxso</dc:creator>
      <dc:date>2019-03-21T10:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451285#M127797</link>
      <description>&lt;P&gt;yeah i tried your suggestion, but it's also taking awhile. there are 3 differente index and souretype. what i want to do is count the totel events from today until now and from minus 7 days ago until now. And if the total events from today are more than the treshold, the alert should be triggered. And i also need add the time when it went over the treshhold&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 10:56:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451285#M127797</guid>
      <dc:creator>nicxso</dc:creator>
      <dc:date>2019-03-21T10:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451286#M127798</link>
      <description>&lt;P&gt;@nickhillscpl &lt;BR /&gt;
Could you tell how I could count all events from today until now and compare that minus 7 days ago ?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 12:08:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-Search/m-p/451286#M127798</guid>
      <dc:creator>nicxso</dc:creator>
      <dc:date>2019-03-21T12:08:45Z</dc:date>
    </item>
  </channel>
</rss>

