Splunk Search

strptime not returning correct results?

RVDowning
Contributor

I have a field in a log: TotalReportRunTime=0:3.313 which is in the format minutes:seconds.milliseconds.

If I use eval runtime=strptime(TotalReportRunTime, "%M:%S.%3N") nothing gets returned.

If I use eval runtime=strptime(TotalReportRunTime, "%H:%M.%3N") I get a value 1336104120.000000 which does not represent 3.313 seconds.

Is there another approach that would work? (Release is 4.3)

Tags (3)

sowings
Splunk Employee
Splunk Employee

Based upon feedback I've seen from others, it seems that both strptime and convert mktime() create values relative to the current epoch time. That is, when you're attempting to parse a duration like 1m32s (or so), strptime and mktime interpret that as "1 min 32 sec from now". The value you quoted is an epoch time, representing "Thu May 3 21:02:00 2012 EDT".

RVDowning
Contributor

I got around the issue by using convert mstime(TotalReportRunTime).

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

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