Splunk Search

Convert Index time

RASHO
New Member

I am trying to change Event time Apr 02, 2019 3:15:34 AM to YYYY-MM-DD HH:MM:SS,sss format.

Tags (1)
0 Karma

pruthvikrishnap
Contributor

Few things can be done here:
1) Use "convert" in search where you input the current format and can edit the desired output.
https://docs.splunk.com/Documentation/Splunk/7.2.5/SearchReference/Convert
2) Eval function can also do this
https://answers.splunk.com/answers/728399/how-do-i-convert-the-date-format-in-a-custom-field.html
3) from CLI place below parameter in props.conf
[sourcetype]
TIME_FORMAT = %Y-%m-%d %k:%M:%S
in
C:\Program Files\Splunk\etc\system\local\props.conf

0 Karma

somesoni2
SplunkTrust
SplunkTrust

In search (converting the date format in search result)??

0 Karma

vnravikumar
Champion

Hi

Are you trying to convert date field to the specified format? Then try this

| makeresults 
| eval source = "Apr 02, 2019 3:15:34 AM" 
| eval epoch =strptime(source,"%b %d, %Y %H:%M:%S %p") 
| eval newdate=strftime(epoch,"%Y-%m-%d %H:%M:%S %p")

If not please explain your requirement in detail.

0 Karma

RASHO
New Member

I am getting events with
Time Event
4/2/19 3:15:34.000 AM Apr 02, 2019 3:15:34 AM xxxxxxxxx

I need to change event time format to YYYY-MM-DD HH:MM:SS,sss

0 Karma

vnravikumar
Champion
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...