Splunk Dev

Time_format_change_procedure

abid91
Engager

Hi Guys,
I am trying to create a use-case as " date when any single user was created in AD" it's done but I need to change time format to readable format, right now it coming like this "20170905133223.0Z" how can I convert it to as " 05-September-2017" I tried with eval command as follows but no effect in results.

search:| ldapsearch domain=default search="(objectClass=user)" | table displayName,whenCreated |eval epochtime=strptime(whenCreated, "%Y %m %d %H:%M:%S") | eval desired_time=strftime(epochtime, "%d/%m/%Y")
result: ABC|20170905133223.0Z
desired result: ABC|05-September-2017

Tags (1)
0 Karma
1 Solution

inventsekar
SplunkTrust
SplunkTrust

Please check -
search:| ldapsearch domain=default search="(objectClass=user)" |eval epochtime=strptime(whenCreated, "%Y%m%d%H%M%S.%1N%Z") | eval desired_time=strftime(epochtime, "%d/%m/%Y") | table displayName whenCreated desired_time

View solution in original post

inventsekar
SplunkTrust
SplunkTrust

Please check -
search:| ldapsearch domain=default search="(objectClass=user)" |eval epochtime=strptime(whenCreated, "%Y%m%d%H%M%S.%1N%Z") | eval desired_time=strftime(epochtime, "%d/%m/%Y") | table displayName whenCreated desired_time

abid91
Engager

Yes! it's working thank you

0 Karma

gcusello
SplunkTrust
SplunkTrust

HI abid91,
try something like this

| ldapsearch domain=default search="(objectClass=user)" 
| eval whenCreated=strftime(strptime(whenCreated, "%Y %m %d %H:%M:%S"), "%d/%m/%Y")
| table displayName,whenCreated 

Check the original time format of whenCreated
Bye.
Giuseppe

0 Karma

abid91
Engager

its showing blank values in whenCreated filed.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...