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
Legend

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
Legend

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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...