<?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 combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179937#M51802</link>
    <description>&lt;P&gt;look, @martin_mueller did provide a way to go by using a &lt;CODE&gt;subsearch&lt;/CODE&gt; and I did show you a way without using one. If you don't want to use any of them I suggest you to start here &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchTutorial/WelcometotheSearchTutorial"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchTutorial/WelcometotheSearchTutorial&lt;/A&gt; &lt;/P&gt;</description>
    <pubDate>Fri, 07 Nov 2014 18:34:01 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2014-11-07T18:34:01Z</dc:date>
    <item>
      <title>How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179928#M51793</link>
      <description>&lt;P&gt;I need to combine a normal search for 24 hr period with all events and a subsearch on threshold based event where it should query for a certain type of  event exceeding a count of 3 in a hour for a host  &lt;/P&gt;

&lt;P&gt;i ran the below command provided by martin-mueller  in earlier thread &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/176574/combining-a-stats-search-and-normal-search.html"&gt;https://answers.splunk.com/answers/176574/combining-a-stats-search-and-normal-search.html&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;index=server  earliest=-24h | append [search index=server event-type=high mem-ultilzation | stats count by hostname | where NOT event-type="high mem-utilization" OR count &amp;gt; 3&lt;/P&gt;

&lt;P&gt;It does provide the host which exceeded the threshold, but the count provided for the event with the threshold value is incorrect.&lt;BR /&gt;
It gives the value as 1 with a flat sparkline, when there were 5 actually occurrences in an hour&lt;/P&gt;

&lt;P&gt;I need the count to be displayed as 5 and not as 1&lt;/P&gt;

&lt;P&gt;Can someone please help in martin's absence &lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 11:26:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179928#M51793</guid>
      <dc:creator>shellnight</dc:creator>
      <dc:date>2014-11-05T11:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179929#M51794</link>
      <description>&lt;P&gt;Hi shellnight,&lt;/P&gt;

&lt;P&gt;if you look at this run everywhere command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=-24h source="*metrics.log" | bucket _time span=10min | stats count(eval(max(kb) &amp;gt;= 200)) AS myCount by _time, series, host, kb | where myCount &amp;gt; 6 AND NOT series="summary"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;does this provide a result you expect?&lt;/P&gt;

&lt;P&gt;The search runs over the last 24 hours, builds &lt;CODE&gt;_time&lt;/CODE&gt; buckets of 10 minutes, counts how many times a series had more then 200 kb throughput per 10 minutes, filters out &lt;CODE&gt;series="summary"&lt;/CODE&gt; and also results which have less than a count of 6 (6 times a 10min bucket makes up one hour).&lt;/P&gt;

&lt;P&gt;Update:&lt;BR /&gt;
Try this, maybe you have to adapt the field names..but, this will point you towards the solution. I don't know if this is a copy/paste answer.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=server 
| bucket _time span=1h 
| stats count(eval(event-type="high mem-ultilzation")) AS hi-men-count count(eval(event-type!="high mem-ultilzation")) AS other-count by _time, event-type, host 
| search (event-type="high mem-ultilzation" AND hi-mem-count&amp;gt;="3") OR (NOT event-type="high mem-ultilzation" AND other-count&amp;gt;="0") 
| eval count=if(other-count=="0", hi-mem-count,  other-count) 
| table event-type, host, count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 11:47:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179929#M51794</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-05T11:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179930#M51795</link>
      <description>&lt;P&gt;It is an eventtype  which occurs frequently on several hosts , I only need the hosts where the event occurs more than 3 times in an hour. All other events in 24hr period  need to remain as they are and no conditions need to be applied for then and need the results for both searches in a single table &lt;/P&gt;

&lt;P&gt;here is a sample table result that i expect, as you can see only server4 is the only host with highmemutil higher  than 3 occurances  in an hour.&lt;/P&gt;

&lt;P&gt;Eventype  hostname Count&lt;BR /&gt;
Diskspacefull  server1    2&lt;BR /&gt;
highmemutlization  server4  5&lt;BR /&gt;
Networkutlizationhigh   server2  20&lt;BR /&gt;
eventtype5       server3        5&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 15:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179930#M51795</guid>
      <dc:creator>shellnight</dc:creator>
      <dc:date>2014-11-05T15:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179931#M51796</link>
      <description>&lt;P&gt;So this &lt;CODE&gt;Eventype&lt;/CODE&gt; is a field in your events/data and not the &lt;CODE&gt;eventtype&lt;/CODE&gt; search command from Splunk, right? The Splunk &lt;CODE&gt;eventtype&lt;/CODE&gt; search command is like a symonym for a search string; for example &lt;CODE&gt;eventtype=error&lt;/CODE&gt; translates to the search &lt;CODE&gt;error OR fatal&lt;/CODE&gt; like in the docs &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/Admin/eventtypesconf"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/Admin/eventtypesconf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 17:29:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179931#M51796</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-05T17:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179932#M51797</link>
      <description>&lt;P&gt;Yes you're right. &lt;/P&gt;

&lt;P&gt;So is there a way to do what i have requested ?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 19:52:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179932#M51797</guid>
      <dc:creator>shellnight</dc:creator>
      <dc:date>2014-11-05T19:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179933#M51798</link>
      <description>&lt;P&gt;sure, I'll have a look at it tomorrow....&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 19:55:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179933#M51798</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-05T19:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179934#M51799</link>
      <description>&lt;P&gt;update ping&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 19:33:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179934#M51799</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-06T19:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179935#M51800</link>
      <description>&lt;P&gt;Also MUS , please  note that I dont want my existing search which contains filters and macros  to be amended , i just want  a subsearch to be added  to my existing search &lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 10:11:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179935#M51800</guid>
      <dc:creator>shellnight</dc:creator>
      <dc:date>2014-11-07T10:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179936#M51801</link>
      <description>&lt;P&gt;it gives error .&lt;BR /&gt;
Error in 'eval' command: Typechecking failed. The '==' operator received different types.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 10:11:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179936#M51801</guid>
      <dc:creator>shellnight</dc:creator>
      <dc:date>2014-11-07T10:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179937#M51802</link>
      <description>&lt;P&gt;look, @martin_mueller did provide a way to go by using a &lt;CODE&gt;subsearch&lt;/CODE&gt; and I did show you a way without using one. If you don't want to use any of them I suggest you to start here &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchTutorial/WelcometotheSearchTutorial"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchTutorial/WelcometotheSearchTutorial&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 18:34:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179937#M51802</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-07T18:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a search for all events with a stats subsearch for a certain event that exceeds a threshold within an hour?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179938#M51803</link>
      <description>&lt;P&gt;Yes martin_mueller did provide a way using subsearch and it gives the right information but the event count and sparkline for the threshold event was incorrect .&lt;/P&gt;

&lt;P&gt;Though they were 5 events for the host , it came as 1 event with a flat sparkline instead of coming as 5.just need that to be corrected&lt;/P&gt;</description>
      <pubDate>Sun, 09 Nov 2014 08:48:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-search-for-all-events-with-a-stats-subsearch/m-p/179938#M51803</guid>
      <dc:creator>shellnight</dc:creator>
      <dc:date>2014-11-09T08:48:16Z</dc:date>
    </item>
  </channel>
</rss>

