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 Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...