Splunk Search

How to Convert epoch time to human readable format?

bugnet
Path Finder

Hi everyone,

I have the following event:

"... src=218.2.3.256 act=block app=ips rt=1433065461040 ...."
The rt field is a epoch computer time format.

Is it possible to convert the "rt" field to a user-friendly format? I searched through some of the other questions but none really addressed this specific question.

Thanks.

Tags (1)
0 Karma
1 Solution

Damien_Dallimor
Ultra Champion

You can use the eval function strftime

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

View solution in original post

Damien_Dallimor
Ultra Champion

You can use the eval function strftime

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

bugnet
Path Finder

Does not work for me .
The "formatted_time" always displayed with the same value : 23:59:59 31-12-9999

0 Karma

Damien_Dallimor
Ultra Champion

Convert your epoch time from millis to seconds

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

0 Karma

bugnet
Path Finder

Its working!
Is it possible to do it permanent ?
I mean- To calculation it automatically on the "rt" field ?

0 Karma

chamambom
New Member

Not sure what you mean but thats what splunk is for ,to transform the fields as you want when creating the reports of the dashboards

0 Karma

anthonysomerset
Path Finder

you need to do a field transform at search or index time - http://docs.splunk.com/Documentation/Splunk/6.3.3/Knowledge/Managefieldtransforms

0 Karma

bugnet
Path Finder

Looks good. How I can do it for all variations of the "rt" numbers?

0 Karma

Damien_Dallimor
Ultra Champion

Can you give more examples ?

0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...