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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...