Splunk Enterprise Security

How do I change the first and last time to actual timeformat="%y-%m-%d %H:%M"?

neely_hpe
New Member

I am looking to take the default datamodel search --

| tstats summariesonly max(_time) as lastTime from datamodel=Malware.Malware_Attacks by Malware_Attacks.signature,Malware_Attacks.dest | drop_dm_object_name("Malware_Attacks") | lookup local=true malware_tracker dest,signature OUTPUT firstTime | eval dayDiff=round((lastTime-firstTime)/86400,1) | search dayDiff>30

But I want to display the actual y-m-d-H-M vs the numeric lastTime and FirstTime values.

How can I do this?

0 Karma

Shan
Builder

@neely_hpe,

Try below example..
It can run anywhere ..

| makeresults 
| eval Time =_time 
| eval Epoc_To_YMD=strftime(Time,"%Y-%m-%d %H:%M:%S")
| eval Date_to_Epoc=strptime(strftime(_time,"%Y-%m-%d %H:%M:%S"),"%Y-%m-%d %H:%M:%S")
| table _time Time Epoc_To_YMD Date_to_Epoc

Thanks

0 Karma
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.


Introducing Unified TDIR with the New Enterprise Security 8.2

Read the blog
Get Updates on the Splunk Community!

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...

Splunk App Developers | .conf25 Recap & What’s Next

If you stopped by the Builder Bar at .conf25 this year, thank you! The retro tech beer garden vibes were ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...