Splunk Dev

How to list the latest time logs for the hosts grouped by source?

abhi04
Communicator

How to list the latest time loalt textgs for the hosts grouped by source?
Please see the attached image for reference for example.

Tags (1)
0 Karma

mayurr98
Super Champion

I think you are looking for something like this :

index=<your_index> 
| stats latest(_time) as latest by source host 
| eval "Latest Log Time"=strftime(latest,"%I:%M:%S %p") 
| fields- latest

Above will be much slower query so you can also use the query given by @FrankVl for faster approach.
In addition to that

| tstats latest(_time) as latest where index=<your_index> by source,host 
| eval "Latest Log Time"=strftime(latest,"%I:%M:%S %p") 
| fields- latest

You need to put <your_index> as your index name.
let me know if this helps!

0 Karma

FrankVl
Ultra Champion
| tstats latest(_time) as latest where index=* by source,host | convert ctime(latest)

Replace index=* by whatever you fancy 🙂

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...