Getting Data In

How to change Time format in raw data to a readable format?

splunkpri
Explorer

Hi Team,

I am getting  date and time format as "Created_time =1649576166225" in raw log we have to convert. Please help me convert in readable format for all logs. Need to do any changes in input level or anything please help me

 

splunkpri_1-1649578057784.png

 

 

 

splunkpri_0-1649577907937.png

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @splunkpri,

as @PickleRick said, the best approach is to leave the timestamp and all the other dates in original format so you can use them as timestamp or to compare dates.

When you need to display ine date you can use the eval command with the strftime function that disaplys a date in the format you prefer, for more infos see at https://docs.splunk.com/Documentation/SCS/current/SearchReference/DateandTimeFunctions#Usage_3 

in few words: to dortma your date from epochtime to human readable YYYY-mm-dd HH:MM:SS you could use:

| eval Created_time=strftime(Created_time,"%Y-%m-%d %H:%M:%S")

Ciao.

Giuseppe

0 Karma

splunkpri
Explorer
 
Tags (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Do not "convert" the value. Use fieldformat to display the field in a human-readable format but leave the original field as it is. You can also create a calculated field which would give you another field containing the rendered string value.

But the first and most important thing is - since this sems to be an excerpt from some json data - where is your _time field being extracted from? Is the created_time field the only field in the event or do you have other time-related fields? If so, which of them is most important?

0 Karma

splunkpri
Explorer

Yes we do have _time field as well in RAW logs. Customer asked us they want Created_time in human readable format

0 Karma
Get Updates on the Splunk Community!

Infographic provides the TL;DR for the 2023 Splunk Career Impact Report

We’ve been shouting it from the rooftops! The findings from the 2023 Splunk Career Impact Report showing that ...

Splunk Lantern | Getting Started with Edge Processor, Machine Learning Toolkit ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...