Splunk Search

Group by latest modified time

ajitsd
Explorer

I have a dataset in Splunk that roughly looks like this

ID=1, Status="Pending", LastModifiedDate="2013-07-14 00:00:00.000", Product=xyz
ID=2, Status="Delivered", LastModifiedDate="2013-07-15 00:00:00.000", Product=xyz
ID=1, Status="Billed", LastModifiedDate="2013-07-16 00:00:00.000", Product=xyz
ID=2, Status="Pending", LastModifiedDate="2013-07-14 00:00:00.000", Product=xyz
ID=1, Status="Delivered", LastModifiedDate="2013-07-15 00:00:00.000", Product=xyz

I was looking for a query that will return the latest (top) modified event group by ID. The query should also suppress older events. For the above set, I was looking at the query to return the following result:

ID=1, Status="Billed", LastModifiedDate="2013-07-16 00:00:00.000", Product=xyz
ID=2, Status="Delivered", LastModifiedDate="2013-07-15 00:00:00.000", Product=xyz

Any ideas on syntax for the query?

Tags (4)
0 Karma

grijhwani
Motivator
{search} | dedup ID sortby -LastModifiedDate
0 Karma

grijhwani
Motivator

It's not a question of syntax, it's a question of knowing functions.

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 ...