Splunk Search

strftime() showing different time

wuming79
Path Finder

I converted my timeStampLight with strftime() but all my time was formatted to 31-12-9999 23:59:59 when I table time .
My timeStampLight is actually showing Epoch time format when I table timeStampLight. The format "%d-%m-%Y %H:%M:%S" should be correct as I managed to get my timestamp for the other log.

Any idea what went wrong with this one??

alt text

alt text

0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi wuming79,
what is your timeStampLight value?
try to divide by 1000 and then apply strftime.

| eval timeStampLight=strftime(timeStampLight/1000,"%d-%m-%Y %H:%M:%S")

Bye.
Giuseppe

View solution in original post

sideview
SplunkTrust
SplunkTrust

It looks like your timeStampLight field isn't actually an epochtime value (seconds since the epoch), but rather milliseconds since the epoch, ie epochtime*1000. So @cusello's suggestion to divide by 1000 before strftime should work for you.

0 Karma

wuming79
Path Finder

ah thanks!

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi wuming79,
what is your timeStampLight value?
try to divide by 1000 and then apply strftime.

| eval timeStampLight=strftime(timeStampLight/1000,"%d-%m-%Y %H:%M:%S")

Bye.
Giuseppe

Get Updates on the Splunk Community!

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

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...

It’s go time — Boston, here we come!

Are you ready to take your Splunk skills to the next level? Get set, because Splunk University is back, and ...

Performance Tuning the Platform, SPL2 Templates, and More New Articles on Splunk ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...