Splunk Search

How to convert time to epoch time?

knalla
Path Finder

How to convert time to epoch time? What the best approach for this one?

Mon 07/23/2018 17:19:01.89

Tags (3)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi knalla,

try this run everywhere search:

 | makeresults 
 | eval myTimeString="Mon 07/23/2018 17:19:01.89", _time=strptime(myTimeString, "%a %m/%d/%Y %H:%M:%S.%2N"), epoch=_time

This will parse your string and creates _time which will be shown human readable in Splunk, and epoch as an epoch time. Read more about strptime() here http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables

Hope this helps ...

cheers, MuS

View solution in original post

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi knalla,

try this run everywhere search:

 | makeresults 
 | eval myTimeString="Mon 07/23/2018 17:19:01.89", _time=strptime(myTimeString, "%a %m/%d/%Y %H:%M:%S.%2N"), epoch=_time

This will parse your string and creates _time which will be shown human readable in Splunk, and epoch as an epoch time. Read more about strptime() here http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables

Hope this helps ...

cheers, MuS

0 Karma
Get Updates on the Splunk Community!

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...