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!

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...