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!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...