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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...