Getting Data In

how to customize time in search not in indexing time

DataOrg
Builder

I have a field as created time.
06-03-2018 13:03:51
06-03-2018 13:03:37
06-03-2018 13:03:38

i want only the date as "06-03-2018". i used strftime but couldnt convert it

0 Karma
1 Solution

493669
Super Champion

HI @premranjithj,
try this:

...| eval temp=split(created_time," ")| eval created_time=mvindex(temp,0)

try this run anywhere search:

|makeresults|eval created_time="06-03-2018 13:03:51"| eval temp=split(created_time," ")| eval created_time=mvindex(temp,0)

View solution in original post

493669
Super Champion

HI @premranjithj,
try this:

...| eval temp=split(created_time," ")| eval created_time=mvindex(temp,0)

try this run anywhere search:

|makeresults|eval created_time="06-03-2018 13:03:51"| eval temp=split(created_time," ")| eval created_time=mvindex(temp,0)

DataOrg
Builder

created_time
06-03-2018
12:43:56
time stamps are in single fields but time is cumng in new line. how to ignore new line timestamp

0 Karma

493669
Super Champion

if I understood correctly that if created_time is multivalue field then try this run anywhere search:

|makeresults|eval created_time="06-03-2018"
|append[|makeresults|eval created_time="13:03:51"]
|stats values(created_time) as created_time
| eval created_time=mvindex(created_time,0)
0 Karma

DataOrg
Builder

06-03-2018
12:43:56

time and date is a single value but time is cumng in new line.I dont want time

0 Karma

493669
Super Champion

have you tried this:

 ...| eval created_time=mvindex(created_time,0)
0 Karma

DataOrg
Builder

yes it not worked

0 Karma

493669
Super Champion

then try this regex:

...|rex field=created_time "(?<a>\S+)"

DataOrg
Builder

06-03-2018 13:03:51. how to change this into strftime(created_time"%y/%b/%d")

0 Karma

493669
Super Champion

try this:

|eval created_time=strftime(strptime(created_time,"%d-%m-%Y %H:%M:%S"),"%Y/%b/%d")
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...