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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...