Splunk Search

How to get most recent results based on field value?

vikram1583
Explorer

Hi,

I'm trying to get the results based on recent field value. How to filter the events with the most recent scan date for all ip's?

scan_date field values
03-01
02-22

Tags (3)
0 Karma

manjunathmeti
SplunkTrust
SplunkTrust

Use stats command.

your search | stats max(scan_date) as scan_date by field

Sample query:

| makeresults | eval _raw="scan_date IP 
03-01 10.0.0.1
02-22 10.0.0.1
03-04 10.1.1.1
02-20 10.1.1.1" | multikv forceheader=1 | table scan_date, IP | stats max(scan_date) as scan_date by IP
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...