<?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 get only latests events from an events set ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-latests-events-from-an-events-set/m-p/474722#M133500</link>
    <description>&lt;P&gt;Many thanks !&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2019 13:55:25 GMT</pubDate>
    <dc:creator>julienlance</dc:creator>
    <dc:date>2019-09-10T13:55:25Z</dc:date>
    <item>
      <title>How to get only latests events from an events set ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-latests-events-from-an-events-set/m-p/474720#M133498</link>
      <description>&lt;P&gt;Hello Splunkers !&lt;/P&gt;

&lt;P&gt;We need your help, as we didn't found any answers solving our issue &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
We will be so grateful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;We have severals events coming from the same sourcetype, identifing source and VPN tunnels dest.&lt;BR /&gt;
These events are sent by packets with the same "_time" value. Due to the network, the delay betwen those packets is random (could be few seconds or one hour).&lt;/P&gt;

&lt;P&gt;Here is an instance : &lt;BR /&gt;
2019-09-06 18:08:35                      ServernameA                                dst-ip:10.10.10.10                        tunnel-state:up&lt;BR /&gt;
2019-09-06 18:08:35                      ServernameA                                dst-ip:10.10.2.2                            tunnel-state:up&lt;BR /&gt;
2019-09-06 18:08:35                      ServernameA                                dst-ip:10.10.2.3                            tunnel-state:down&lt;BR /&gt;
2019-09-06 18:08:35                      ServernameA                                dst-ip:10.10.2.4                           tunnel-state:up&lt;BR /&gt;
2019-09-06 18:08:31                      ServernameA                                dst-ip:10.10.10.10                        tunnel-state:up&lt;BR /&gt;
2019-09-06 18:08:31                      ServernameA                                dst-ip:10.10.2.2                            tunnel-state:up&lt;BR /&gt;
2019-09-06 18:08:31                      ServernameA                                dst-ip:10.10.2.3                            tunnel-state:down&lt;BR /&gt;
2019-09-06 18:08:31                      ServernameA                                dst-ip:10.10.2.4                           tunnel-state:up&lt;BR /&gt;
2019-09-06 18:04:31                      ServernameA                                dst-ip:10.10.10.10                        tunnel-state:up&lt;BR /&gt;
2019-09-06 18:04:31                      ServernameA                                dst-ip:10.10.2.2                            tunnel-state:up&lt;BR /&gt;
2019-09-06 18:04:31                      ServernameA                                dst-ip:10.10.2.3                            tunnel-state:down&lt;BR /&gt;
2019-09-06 18:04:31                      ServernameA                                dst-ip:10.10.2.4                           tunnel-state:up&lt;/P&gt;

&lt;P&gt;We want to show in a table only the last events (here, events sent at 18:08:35).&lt;BR /&gt;
First, we tried with the relative time-picker for 15mins or 60 mins. But as the delaying time betwen events is random, it's not working, both events are presented.&lt;/P&gt;

&lt;P&gt;In a second time, we tried with the "last" command, as the following example :&lt;BR /&gt;
index="vpn-state" sourcetype="routers:json" hostname=ServernameA earliest =-900s&lt;BR /&gt;
| stats last(_time) as last_time &lt;BR /&gt;
| table _time,hostname,dst-ip,tunnel-state&lt;BR /&gt;
| where _time ==last_time&lt;/P&gt;

&lt;P&gt;But that doesn't work too, probably a syntax error or because "stats" results can't be evaluated.&lt;/P&gt;

&lt;P&gt;Any clues for helping us ?&lt;BR /&gt;
Many thanks !&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:06:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-latests-events-from-an-events-set/m-p/474720#M133498</guid>
      <dc:creator>julienlance</dc:creator>
      <dc:date>2020-09-30T02:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only latests events from an events set ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-latests-events-from-an-events-set/m-p/474721#M133499</link>
      <description>&lt;P&gt;&lt;CODE&gt;stats&lt;/CODE&gt; results can indeed be evaluated.  The problem in your example query is &lt;CODE&gt;stats&lt;/CODE&gt; only returns one field, last_time, so _time, hostname, etc. are not available to &lt;CODE&gt;table&lt;/CODE&gt;.  That can be resolved by using &lt;CODE&gt;eventstats&lt;/CODE&gt; in place of &lt;CODE&gt;stats&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:09:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-latests-events-from-an-events-set/m-p/474721#M133499</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-10T13:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only latests events from an events set ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-latests-events-from-an-events-set/m-p/474722#M133500</link>
      <description>&lt;P&gt;Many thanks !&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-latests-events-from-an-events-set/m-p/474722#M133500</guid>
      <dc:creator>julienlance</dc:creator>
      <dc:date>2019-09-10T13:55:25Z</dc:date>
    </item>
  </channel>
</rss>

