Splunk Search

Latest time and the corresponding raw data

prettysunshinez
Explorer

Hi,
Can anyone help me how to get the latest time of an event and its corresponding raw logs(_raw).
When i use stats latest(_time),values(_raw)..
I get the latest time but a consolidated list of raw logs.

Tags (1)
0 Karma

arjunpkishore5
Motivator

Hi @prettysunshinez

In your case, you don't need to use stats, all you need is this

index= "search_string" 
| head 1 

If you need this in a table format, just add | table _time, _raw to the end of your query

This will give you the latest record. Please try and let me know if this is what you were looking for. Please mark as answer if yes.

Cheers.

0 Karma

rmmiller
Contributor

I think you want this instead:

stats latest(_time), latest(_raw)

Hope that helps!
rmmiller

0 Karma

prettysunshinez
Explorer

Can someone help please

0 Karma

arjunpkishore5
Motivator

Could you please elaborate or post the query ? Are you just trying to get the latest record in the index ?

0 Karma

prettysunshinez
Explorer

I'm looking for the latest time and _raw data of a particular string.

index= "search_string" |stats latest(_time) as Latest,values(_raw)

In the result I'm getting the latest time but all the values of _raw instead of the latest one.

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