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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...