Splunk Search

Is there an easy way to convert the default time stamp to epoch time?

sherman
Engager

Hello,

I am trying to convert the default time stamp for my events to epoch time, but for that it seems that I have to concatenate date_month, date_year, date_mday, date_hour etc... to a single string and then use the strptime function:

eval t=date_month+","+date_mday+","+date_year+" " +date_hour+":"+date_minute+":"+date_second

and then pipe it to:

eval d=strptime(t,"%b,%d,%Y %H:%M:%S")

is there an easier or faster way to do that?

Tags (1)
1 Solution

hexx
Splunk Employee
Splunk Employee

Indeed there is a simpler way. Try:

eval t=_time

View solution in original post

hexx
Splunk Employee
Splunk Employee

Indeed there is a simpler way. Try:

eval t=_time

sherman
Engager

Thank you very much!

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...