Getting Data In

How to GET latest and previous events from a different host?

jadengoho
Builder

Hi all ,
This is my problem : I have a table with time,log and host.
sample :

host 1  <event log> 2018-06-05 23:01:30
host 2  <event log> 2018-06-05 23:01:30

host 2  <event log> 2018-06-05 23:01:29
host 3  <event log> 2018-06-05 23:01:29

host 1  <event log> 2018-06-05 23:01:28
host 3  <event log> 2018-06-05 23:01:28

host 1  <event log> 2018-06-05 23:01:27
host 2  <event log> 2018-06-05 23:01:27
host 3  <event log> 2018-06-05 23:01:27

......

Now i want to only get was the latest and the previous
like this :

LATEST
host 1    <event log> 2018-06-05 23:01:30
host 2    <event log> 2018-06-05 23:01:30
host 3    <event log> 2018-06-05 23:01:29

PREVIOUS 
host 1    <event log> 2018-06-05 23:01:28
host 2    <event log> 2018-06-05 23:01:29
host 3    <event log> 2018-06-05 23:01:28

Is there a way or workaround to get this result ?
Thanks in advance

0 Karma
1 Solution

493669
Super Champion

use dedup command to get latest 2 events :

...|dedup 2 host

View solution in original post

0 Karma

493669
Super Champion

use dedup command to get latest 2 events :

...|dedup 2 host
0 Karma

jadengoho
Builder

I am not aware that i can do this , will definitely try this

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...