Splunk Search

Issue trying to use ctime

msarro
Builder

Hey everyone, I am trying to convert two different date fields into unix time to do some mathematical operations. One of my timestamps doesn't want to convert for some reason. Here it is:
20110527162327.013

The time format is YYYYMMDDHHmmss.sss.

I pass it into convert like so:

convert timeformat="%Y%m%d%H%M%S.%q" mktime(AS_Start_Time) 

But it still outputs the exact same input time. Anyone have any ideas?

Tags (1)
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

I suppose it's a bug, but convert...mktime() is probably deprecated at this point in favor of eval...strptime():

eval AS_Start_Time=strptime(AS_Start_Time,"%Y%m%d%H%M%S.%q")

msarro
Builder

The documentation for version 4.2.1 does not show convert as deprecated. Just curious if you're going by best practices or is the function in fact deprecated and the documentation doesn't reflect that?

0 Karma
Get Updates on the Splunk Community!

More Control Over Your Monitoring Costs with Archived Metrics!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...