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
Get Updates on the Splunk Community!

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...

Splunk Observability for AI

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