Splunk Search

Retrieve all latest rows that share the same _time value?

HappyFeet
Engager

I have an application that sends logs to Splunk every few seconds. These logs are "snapshots" which provide a static view of the system at the time they were taken/sent to Splunk.

I am attempting to get the latest rows from Splunk and present them in a table. Latest rows are determined by _time.

In the example below I want to retrieve the two last rows because they have the highest _time value.

Any help would be appreciated.

_time Name Status
9/28/22
8:14:08.968 PM
SPID 1 Queued
9/28/22
8:14:08.968 PM
SPID 2 Started
9/28/22
8:14:08.968 PM
SPID 3 Failing
9/28/22
8:14:12.968 PM
SPID 1 Started
9/28/22
8:14:12.968 PM
SPID 2 Started

 

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

There may be several ways to do that, but here's the first one I thought of.

<<your current search>>
| eventstats max(_time) as max_time
| where _time=max_time
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

There may be several ways to do that, but here's the first one I thought of.

<<your current search>>
| eventstats max(_time) as max_time
| where _time=max_time
---
If this reply helps you, Karma would be appreciated.

HappyFeet
Engager

I tried doing something similar with eventstats by counting the number events and grouping by _time to return all events that share the same count but it was not working as I wanted it to.

Thank you. That's surprisingly simple

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...