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 Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...