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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...