<?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 Is it possible to ignore the last result? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362082#M169988</link>
    <description>&lt;P&gt;good afternoon&lt;/P&gt;

&lt;P&gt;I have the following query&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| dbxquery connection = connection&lt;BR /&gt;
query = "....."&lt;/P&gt;

&lt;P&gt;| chart eval (round (max&lt;BR /&gt;
(AttachFailure2G), 2)) as&lt;BR /&gt;
Attach_Failure_2G, eval (round (max&lt;BR /&gt;
(AttachSuccess2G), 2)) as&lt;BR /&gt;
Attach_Success_2G by Fecha_Hora&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;example:&lt;/P&gt;

&lt;P&gt;1 - 2018-04-25 14: 45: 00.000 | 7.67 | 95.85 &amp;lt;- ignore&lt;BR /&gt;
2 - 2018-04-25 14: 30: 00.000 | 23.80 | 79.19&lt;BR /&gt;
3 - 2018-04-25 14: 15: 00.000 | 23.76 | 79.11&lt;BR /&gt;
4 - 2018-04-25 14: 00: 00.000 | 23.73 | 79.17&lt;/P&gt;

&lt;P&gt;But it is required to ignore the last event brought from the query, is this possible?&lt;/P&gt;

&lt;P&gt;regards&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 19:14:48 GMT</pubDate>
    <dc:creator>efaundez</dc:creator>
    <dc:date>2020-09-29T19:14:48Z</dc:date>
    <item>
      <title>Is it possible to ignore the last result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362082#M169988</link>
      <description>&lt;P&gt;good afternoon&lt;/P&gt;

&lt;P&gt;I have the following query&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| dbxquery connection = connection&lt;BR /&gt;
query = "....."&lt;/P&gt;

&lt;P&gt;| chart eval (round (max&lt;BR /&gt;
(AttachFailure2G), 2)) as&lt;BR /&gt;
Attach_Failure_2G, eval (round (max&lt;BR /&gt;
(AttachSuccess2G), 2)) as&lt;BR /&gt;
Attach_Success_2G by Fecha_Hora&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;example:&lt;/P&gt;

&lt;P&gt;1 - 2018-04-25 14: 45: 00.000 | 7.67 | 95.85 &amp;lt;- ignore&lt;BR /&gt;
2 - 2018-04-25 14: 30: 00.000 | 23.80 | 79.19&lt;BR /&gt;
3 - 2018-04-25 14: 15: 00.000 | 23.76 | 79.11&lt;BR /&gt;
4 - 2018-04-25 14: 00: 00.000 | 23.73 | 79.17&lt;/P&gt;

&lt;P&gt;But it is required to ignore the last event brought from the query, is this possible?&lt;/P&gt;

&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:14:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362082#M169988</guid>
      <dc:creator>efaundez</dc:creator>
      <dc:date>2020-09-29T19:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to ignore the last result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362083#M169989</link>
      <description>&lt;P&gt;Try something like this.. I tested it against an internal index and it's working as expected, you can apply this against your internal index too and verify it works before applying it with your SPL &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal   component=TailReader 
| eval latest_time=relative_time(now(),"-15m@m"), now=now()
| bin _time span=15m
| stats max(host) by _time, latest_time
| eval ignore_latest_time=if(_time&amp;lt;'latest_time',0,1)
| where ignore_latest_time&amp;lt;1

| eval latest_time=strftime(latest_time,"%H:%M:%S"), now=strftime(now,"%H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;We first create 2 evals to get the time 15 minutes ago and now&lt;/LI&gt;
&lt;LI&gt;We use &lt;CODE&gt;bin&lt;/CODE&gt; to make 15 minute buckets of time&lt;/LI&gt;
&lt;LI&gt;We use a &lt;CODE&gt;stats&lt;/CODE&gt; to transform our data into a table view&lt;/LI&gt;
&lt;LI&gt;We use &lt;CODE&gt;eval&lt;/CODE&gt;conditional logic to say if _time is less than our variable &lt;CODE&gt;latest_time&lt;/CODE&gt; which was defined in step 1, then give this field a "0", else give it a "1". This will result in only 1 row having a value of 1 since we have 15 minute span bins&lt;/LI&gt;
&lt;LI&gt;We than use &lt;CODE&gt;where&lt;/CODE&gt; to count all values less than 1 which will remove the latest row&lt;/LI&gt;
&lt;LI&gt;We add &lt;CODE&gt;strftime&lt;/CODE&gt; to make the _time fields human readable&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362083#M169989</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2020-09-29T19:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to ignore the last result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362084#M169990</link>
      <description>&lt;P&gt;You can remove the event that's listed first by adding this to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
| streamstats count AS order_count
| where order_count&amp;gt;1 
| fields - order_count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This adds a field called &lt;CODE&gt;order_count&lt;/CODE&gt; to each line, and the first line will always receive the value &lt;CODE&gt;1&lt;/CODE&gt;. So we filter to retain only events with &lt;CODE&gt;order_count&amp;gt;1&lt;/CODE&gt; and then remove the field because we no longer need it.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:02:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362084#M169990</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-04-25T20:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to ignore the last result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362085#M169991</link>
      <description>&lt;P&gt;You can add this to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats count AS _serial
| search _serial &amp;gt; 1
| fields - _serial
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;P.S. sometimes you get &lt;CODE&gt;_serial&lt;/CODE&gt; for free so try it without the first &lt;CODE&gt;streamstats&lt;/CODE&gt; line and see.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:05:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362085#M169991</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-04-25T20:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to ignore the last result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362086#M169992</link>
      <description>&lt;P&gt;thanks for the answer, I realized that I explained my concern wrongly because the last value corresponded to the first: P means&lt;/P&gt;

&lt;P&gt;1 - 2018-04-25 14: 00: 00.000 | 23.73 | 79.17&lt;BR /&gt;
2 - 2018-04-25 14: 15: 00.000 | 23.76 | 79.11&lt;BR /&gt;
3 - 2018-04-25 14: 30: 00.000 | 23.80 | 79.19&lt;BR /&gt;
4 - 2018-04-25 14: 45: 00.000 | 7.67 | 95.85 &amp;lt;- ignore&lt;/P&gt;

&lt;P&gt;but how to validate that doing a | sort -Date_Hour and adding&lt;/P&gt;

&lt;P&gt;| streamstats count AS order_count&lt;BR /&gt;
&amp;nbsp; | where order_count&amp;gt; 1&lt;BR /&gt;
&amp;nbsp; | fields - order_count&lt;/P&gt;

&lt;P&gt;like&lt;/P&gt;

&lt;P&gt;| streamstats count AS _serial&lt;BR /&gt;
&amp;nbsp; | search _serial&amp;gt; 1&lt;BR /&gt;
&amp;nbsp; | fields - _serial&lt;/P&gt;

&lt;P&gt;ignores the last value or the most recent value&lt;/P&gt;

&lt;P&gt;Thank you:&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362086#M169992</guid>
      <dc:creator>efaundez</dc:creator>
      <dc:date>2020-09-29T19:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to ignore the last result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362087#M169993</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;
May be this solution help you or another person, it's another proposition:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
 | eventstats max(Fecha_Hora) as maxTime
 | where Fecha_Hora!=maxTime
 | fields - maxTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The Fecha__Hora represent the time if not use _time field &lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 21:53:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362087#M169993</guid>
      <dc:creator>TISKAR</dc:creator>
      <dc:date>2018-04-25T21:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to ignore the last result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362088#M169994</link>
      <description>&lt;P&gt;thanks, it works.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 12:45:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-ignore-the-last-result/m-p/362088#M169994</guid>
      <dc:creator>efaundez</dc:creator>
      <dc:date>2018-04-26T12:45:38Z</dc:date>
    </item>
  </channel>
</rss>

