Splunk Search

Can I use tstats and get most recent event date

a212830
Champion

Hi,

Is it possible to get the data of the most recent event per sourcetype when using tstats? I have a search - |tstats count WHERE index=ngccc* AND (host=vlmmk179 OR host=vlrtp218) by host, sourcetype

that returns what I want, but I was wondering if it was possible to add the most recent event for host and sourcetype combination?

Tags (2)
0 Karma

sloshburch
Ultra Champion

Not exactly what you're looking for, but don't forget the metadata command just for finding information about what's in the indexes.

0 Karma

somesoni2
Revered Legend

I think you can. Try something like this

|tstats count max(_time) as _time WHERE index=ngccc* AND (host=vlmmk179 OR host=vlrtp218) by host, sourcetype
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...