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
Splunk Employee
Splunk Employee

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

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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...