<?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: Searching Max values in a span/range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166233#M186099</link>
    <description>&lt;P&gt;No - I want to group a number of Events together and get the Base of the first event in the group and the get the highest Max for the group.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jul 2014 21:14:27 GMT</pubDate>
    <dc:creator>jlkokko</dc:creator>
    <dc:date>2014-07-31T21:14:27Z</dc:date>
    <item>
      <title>Searching Max values in a span/range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166231#M186097</link>
      <description>&lt;P&gt;I'm not sure of the proper approach for this query. I have a list of events,one event per day, with  fields min,max and base. Starting with any date I need to pull the base for that date as well as the highest Max in a range span of 3 or 4 events [Note: I say events because because the log has missing dates].&lt;/P&gt;

&lt;P&gt;as an Example snippet:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Date,Min,Max,Base&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;2014-07-23,8.66,8.79,8.59&lt;/P&gt;

&lt;P&gt;2014-07-22,8.68,8.74,8.58&lt;/P&gt;

&lt;P&gt;2014-07-21,8.59,8.69,8.49&lt;/P&gt;

&lt;P&gt;2014-07-18,8.59,8.73,8.45&lt;/P&gt;

&lt;P&gt;I would need to return the date, its base and the highest Max in the range:&lt;/P&gt;

&lt;P&gt;Date, Base, Max&lt;BR /&gt;
2014-07-18, 8.45, 8.68&lt;/P&gt;

&lt;P&gt;For creating the ranges, should I should use a &lt;EM&gt;span&lt;/EM&gt; or a &lt;EM&gt;bin&lt;/EM&gt; with a &lt;EM&gt;foreach&lt;/EM&gt; or is there a more appropriate method?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2014 20:11:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166231#M186097</guid>
      <dc:creator>jlkokko</dc:creator>
      <dc:date>2014-07-31T20:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Searching Max values in a span/range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166232#M186098</link>
      <description>&lt;P&gt;You want to group fix no of EVENTS together and get the Base and Max value for the lowest date?? (base on the sample output that you provided)&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2014 20:39:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166232#M186098</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-31T20:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Searching Max values in a span/range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166233#M186099</link>
      <description>&lt;P&gt;No - I want to group a number of Events together and get the Base of the first event in the group and the get the highest Max for the group.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2014 21:14:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166233#M186099</guid>
      <dc:creator>jlkokko</dc:creator>
      <dc:date>2014-07-31T21:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Searching Max values in a span/range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166234#M186100</link>
      <description>&lt;P&gt;Try something like this (assuming the fields are already extracted by same name.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | streamstats count | eval count=floor((count-1)/4) | stats first(Date) as Date first(Base) as Base max(Max) as Max by count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where '4' is the bin size.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2014 21:27:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166234#M186100</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-31T21:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Searching Max values in a span/range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166235#M186101</link>
      <description>&lt;P&gt;Not sure if I understand your requirements correctly... here's what I think you want:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;grab the event for the specified date&lt;/LI&gt;
&lt;LI&gt;grab the next (for example) 3 events that happened after that - might be the next three days, might have gaps&lt;/LI&gt;
&lt;LI&gt;return the original event's date and base value as well as the maximum max value over all four events&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Since there's no way or knowing how far in the future you need to look to get the next three events you could do something like this run over a timerange from the specified date to now:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | tail 4 | stats earliest(Date) as Date earliest(Base) as Base max(Max) as Max
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If your specified date is far into the past and there's a lot of data since then this would churn through all of the data and discard most of them - so if possible you can specify a latest time closer to the specified date but far away enough to be sure there will be another three events in there.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2014 23:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-Max-values-in-a-span-range/m-p/166235#M186101</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-08-01T23:14:12Z</dc:date>
    </item>
  </channel>
</rss>

