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!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

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