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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...