Splunk Search

How can I get the latest result?

abi2023
Path Finder

my spl 
base search |transaction ID | table date field1 field2 ID

my result 

 

Date                 field1      fiel2         ID
02/20/23        CCC        2k               10

02/20/23         c2           4k                11

02/10/23.         CC          2k             08

02/01/23           C             5k              01

but I only want to output latest result which 02/20/23 assuming begin of the I don't date for latest event. 

 

Labels (1)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

Is your date field different to _time? Also, you have two dates the same value, but if date is different to _time then do this

 

base search 
| transaction ID 
| eval tmp=strptime(date, "%m/%d/%y")
| sort 1 - tmp
| table date field1 field2 ID

 

if date is the same as _time then you just need

base search 
| transaction ID 
| sort 1 - _time
| table date field1 field2 ID

but how do you want to differentiate between the first two events that have the same date?

 

0 Karma

somesoni2
Revered Legend

Give this a try

base search |transaction ID | table date field1 field2 ID
| eventstats latest(date) as latestDate
| where date=latestDate | fields - latestDate
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...