Splunk Search

Duration of a single event

CarmineCalo
Path Finder

Splunkers!

I need to compute the duration of a event, as the difference between the two field (END_TIME and OPEN_TIME).
Time format of END_TIME and OPEN_TIME is the following: 2017-12-31-20.01.37.000000

Code is the following:

| eval END_INC=strptime(CLOSE_TIME, "%b %d %Y %H.%M.%S.%3N%P"), BEG_INC=strptime(OPEN_TIME, "%b %d %Y %H.%M.%S.%3N%P")
| eval duration=END_INC - BEG_INC

Not clear how to set parameters in strptime.

Any help?

Tks!
Carmine

0 Karma
1 Solution

Ayn
Legend

A reference on variables you can use when parsing timestamps with strptime can be found in the docs here: http://docs.splunk.com/Documentation/Splunk/6.6.3/SearchReference/Commontimeformatvariables

In your case you want something like %Y-%m-%d-%H.%M.%S.%6N.

View solution in original post

Ayn
Legend

A reference on variables you can use when parsing timestamps with strptime can be found in the docs here: http://docs.splunk.com/Documentation/Splunk/6.6.3/SearchReference/Commontimeformatvariables

In your case you want something like %Y-%m-%d-%H.%M.%S.%6N.

CarmineCalo
Path Finder

Tks, it works!
Now I got how to use strptime.

Tks Again,
Carmine

0 Karma

MuS
Legend

Welcome back @Ayn ! It's been a long time 😉

cheers, MuS

PS: you should sign up for slack as well http://docs.splunk.com/Documentation/Community/1.0/community/Chat

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...