Getting Data In

Convert Epoch timestamp

satishsdange
Builder

I am trying to convert epoch timestamp of stopTime into %m/%d/%Y %H:%M:%S , but I am getting 12/31/9999 23:59:59

"traceId":xxxxx,"startTime":1395740488120,"stopTime":1395740497550

This is what I am using -

rex "^(?:[^:\n]*:){3}(?P<endtime>\d+)" | eval StopTime=strftime(endtime, "%m/%d/%Y %H:%M:%S")

Could someone please let me know what could be the problem?

TIA

0 Karma
1 Solution

vganjare
Builder

Hi,

Are you using the time in millisecond format? Please see following time comparison:
1427110824 - Epoch time for today
1395740497550

If you divide endtime by 1000, it should work fine.

Thanks!

View solution in original post

0 Karma

vganjare
Builder

Hi,

Are you using the time in millisecond format? Please see following time comparison:
1427110824 - Epoch time for today
1395740497550

If you divide endtime by 1000, it should work fine.

Thanks!

0 Karma
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...