Knowledge Management

convert extracted time from log to start_time

awedmondson
Explorer

I have extracted an event time as a field from an event as
Nov 27, 2014 9:42

presently I have:
convert timeformat="%m/%d/%Y %H:%M:%S" ctime(_time) AS start_time
But for some reason, splunk occasional reads the event time stamp 8 hours out, so I have extracted Nov 27, 2014 9:42, question is how can I get it as start_time

thanks

Tags (2)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You're looking at "Nov 27,2014" but are parsing "%m/%d/%Y" - those two don't fit together. This works for me:

| stats count | eval event_time = "Nov 27, 2014 9:42" | eval start_time = strptime(event_time, "%b %d, %Y %H:%M") | eval test = strftime(start_time, "%+")

The test field is there to confirm the parsing worked correctly. Note I'm looking for "%b %d, %Y" for the date which matches "Nov 27, 2014".

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...