Knowledge Management

How to use a calculated field to calculate overall response time?

mschellhouse
Path Finder

We have event records that cut a beginTime and endTime. We have the search necessary to calculate overall response time but would like to try and get logic into a calculated field or ??? so that every user does have to add this to their adhoc query.

Search used to calculate response time:

convert timeformat="%Y/%m/%d %H:%M:%S.%3N" mktime(beginTime) as bTime  mktime(endTime) as eTime | eval RT = eTime-bTime

Any ideas?

0 Karma
1 Solution

adonio
Ultra Champion

Hi mshcellhouse,
Combining here both comments above.
you can use calculated fields: navigate to settings -> fileds -> calculated fields -> new -> pick an app -> choose sourcetype -> name the newCalculatedField -> use eval (this will replace the convert command)
save it and give it either app permissions or global permissions.
now everyone can use it.
@somesoni extends and give full solution here:
Name of the calculated field - RT
Eval expression: strptime(endTime,"%Y/%m/%d %H:%M:%S.%3N")-strptime(beginTime,"%Y/%m/%d %H:%M:%S.%3N")

See this link for instructions to create one from Splunk Web
https://docs.splunk.com/Documentation/Splunk/6.5.2/Knowledge/CreatecalculatedfieldswithSplunkWeb

View solution in original post

adonio
Ultra Champion

Hi mshcellhouse,
Combining here both comments above.
you can use calculated fields: navigate to settings -> fileds -> calculated fields -> new -> pick an app -> choose sourcetype -> name the newCalculatedField -> use eval (this will replace the convert command)
save it and give it either app permissions or global permissions.
now everyone can use it.
@somesoni extends and give full solution here:
Name of the calculated field - RT
Eval expression: strptime(endTime,"%Y/%m/%d %H:%M:%S.%3N")-strptime(beginTime,"%Y/%m/%d %H:%M:%S.%3N")

See this link for instructions to create one from Splunk Web
https://docs.splunk.com/Documentation/Splunk/6.5.2/Knowledge/CreatecalculatedfieldswithSplunkWeb

mschellhouse
Path Finder

Nailed it! Thanks all!

0 Karma

adonio
Ultra Champion

hi mschellhouse, hope i understand your question,
you can use calculated fields: navigate to settings -> fileds -> calculated fields -> new -> pick an app -> choose sourcetype -> name the newCalculatedField -> use eval (this will replace the convert command)
save it and give it either app permissions or global permissions.
now everyone can use it.

somesoni2
SplunkTrust
SplunkTrust

Extending @adonio's suggestion, this is what you'll be putting in calculated field

Name of the calculated field - RT
Eval expression: strptime(endTime,"%Y/%m/%d %H:%M:%S.%3N")-strptime(beginTime,"%Y/%m/%d %H:%M:%S.%3N")

See this link for instructions to create one from Splunk Web
https://docs.splunk.com/Documentation/Splunk/6.5.2/Knowledge/CreatecalculatedfieldswithSplunkWeb

Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...