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!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...