Getting Data In

How to change the time field value /date(1548574937484) to human readable format ?

balu1211
Path Finder
 
Labels (1)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @balu1211,

you need two steps:

  • extract the date in epochtime format
  • convert date from epochtime to Human Readable.

something like this:

| makeresults 
| eval WhenOccurred="/date(1548574937484)"
| rex field=WhenOccurred "(?<date_epoch>\d+)"
| eval date=strftime(date_epoch/1000,"%Y-%m-%d %H:%M:%S")
| table date_epoch date

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @balu1211,

you have to use the strftime option in the eval command (https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/DateandTimeFunctions#strftime.28...), something like this:

<your_search>
| eval date=strftime(date,"%Y-%m-%d %H:%M:%S")

Ciao.

Giuseppe

0 Karma

balu1211
Path Finder

Hi @gcusello ,

My usecase is like want to convert the WhenOccurred field format to readable format.

Thanks 

IMG_20221103_201843.jpg

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @balu1211,

you need two steps:

  • extract the date in epochtime format
  • convert date from epochtime to Human Readable.

something like this:

| makeresults 
| eval WhenOccurred="/date(1548574937484)"
| rex field=WhenOccurred "(?<date_epoch>\d+)"
| eval date=strftime(date_epoch/1000,"%Y-%m-%d %H:%M:%S")
| table date_epoch date

Ciao.

Giuseppe

balu1211
Path Finder

Hi @gcusello,

 

eval WhenOccurred="/date(1548574937484)"

What i have to mention in the  

| eval  WhenOccurred="/date (   ) "   ? 

Default it is taking 1548574937484 for all  values 

 

Thanks.....

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @balu1211,

first two rows are only for my test, your search is:

<your_search>
| rex field=WhenOccurred "(?<date_epoch>\d+)"
| eval date=strftime(date_epoch/1000,"%Y-%m-%d %H:%M:%S")
| table date_epoch date

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...