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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...