Splunk Search

Pickup the latest row of records.

ishugupta
Path Finder

acct_nbr event_stamp membership_fee Zip_Code
12345 2014-07-08-10.27.13.000000 0.00 222
12345 2014-07-07-12.03.03.000000 55.00 222
67890 2014-07-14-12.03.03.000000 45.00 444
67890 2014-07-11-10.27.13.000000 44.00 444
67890 2014-07-15-12.03.03.000000 45.00 444

In the above record , I want to pick up the latest account number and its corresponding membership fee and zip based on the event_stamp field . I am not sure how to pick them . Below is the output I want:

12345 2014-07-08-10.27.13.000000 0.00 222
67890 2014-07-15-12.03.03.000000 45.00 444

Of all the methods I have tried , I am able to pick the latest time stamp , but I am not able to pick all the corresponding records .

Tags (2)
0 Karma
1 Solution

strive
Influencer

Assuming that the records will be in same order as you have mentioned try this

your search | stats first(event_stamp) as event_stamp, first(membership_fee) as membership_fee, first(Zip_Code) as Zip_Code by acct_nbr

I used your data as CSV and see the output
alt text

View solution in original post

strive
Influencer

Assuming that the records will be in same order as you have mentioned try this

your search | stats first(event_stamp) as event_stamp, first(membership_fee) as membership_fee, first(Zip_Code) as Zip_Code by acct_nbr

I used your data as CSV and see the output
alt text

ishugupta
Path Finder

Thanks Strive... very simple and apt solution...I was beating all around the bush...

0 Karma
Get Updates on the Splunk Community!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...