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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...