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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...