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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...