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
Revered Legend

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 ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...